[英]How can I achieve this view?
我试过使用带有LinearLayout的HorizontalScrollView。 它看起来完全像图片,但是我不想使用ScrollView,因为在启动时会显示滚动条,而这不是我想要的。
我还尝试了相对视图,每个视图彼此对齐,但是最后一个视图按比例缩小,以适应剩余的小空间。
有小费吗?
试试这个,您可以使用此setHorizontalScrollBarEnabled()
启用或禁用滚动条
Scrool.setHorizontalScrollBarEnabled(true)
不推荐使用图库。 因此,推荐的方法是HorizontalScrollView。 如果不想在启动过程中显示滚动条,可以打开/关闭滚动条,然后在启动后将其打开。
该类已在API级别16中弃用。不再支持此小部件。 其他水平滚动小部件包括支持库中的HorizontalScrollView和ViewPager。
您为什么不尝试仿制Gallery
视图。 据我所知,这可以满足您的需求。
找到一个解决方案:
创建了一个内部带有水平LinearLayout的RelativeLayout。 RelativeLayout(最高父级),宽度为1500dp。 然后什么都不叫。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="1500dp"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#ffffffff">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/techinc_splash_1" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/techinc_splash_1" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/techinc_splash_1" />
</LinearLayout>
</RelativeLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.