ScrollView中的图像在小屏幕上看起来很好,但在大屏幕上就不行了。我想让它自动适应屏幕,30% ScrollView和70% ImageView。非常感谢您的帮助:)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/IVdisplay"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/a" />
</LinearLayout>
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/IVimage1"
android:layout_width="85dp"
android:layout_height="75dp"
android:padding="5dp"
android:scaleType="fitXY"
android:src="@drawable/a" />
</LinearLayout>
</ScrollView>
发布于 2013-12-29 17:46:38
将父布局更改为LinearLayout,它会自动与给定的weight对齐。请尝试以下操作:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:weightSum="100" >
<ImageView
android:id="@+id/IVdisplay"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="@drawable/a" />
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_alignParentLeft="true"
android:layout_weight="30" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/IVimage1"
android:layout_width="85dp"
android:layout_height="75dp"
android:padding="5dp"
android:scaleType="fitXY"
android:src="@drawable/a" />
</LinearLayout>
</ScrollView>
https://stackoverflow.com/questions/20823834
复制相似问题