调整图像视图的布局
Adjusting layout for an imageview
我想调整应用程序的布局。
首先,我是 android 设计中的新手。
我在 scrollview 中做了一个线性布局。
但是在调整布局时,图像之间有很多空间。我想摆脱它。
图像的宽度应等于 phone 的显示宽度。必须自动调整高度。
下面列出了xml代码。
如果问题不清楚,请评论我。
<ScrollView 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:id="@+id/scrollView">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/sldr4" />
<ImageView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/sldr4" />
</LinearLayout>
</ScrollView>
您正在寻找 adjustViewBounds XML 属性:
android:adjustViewBounds="true"
我想调整应用程序的布局。 首先,我是 android 设计中的新手。 我在 scrollview 中做了一个线性布局。 但是在调整布局时,图像之间有很多空间。我想摆脱它。
图像的宽度应等于 phone 的显示宽度。必须自动调整高度。
下面列出了xml代码。 如果问题不清楚,请评论我。
<ScrollView 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:id="@+id/scrollView">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/sldr4" />
<ImageView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/sldr4" />
</LinearLayout>
</ScrollView>
您正在寻找 adjustViewBounds XML 属性:
android:adjustViewBounds="true"