我想得到的是::
< I am trying to display same look on both landscape and portrait mode
>
我当前拥有的:: ::在不同的方向模式下观察imageview
外观不同> imageview的高度在纵向模式下更多
grid_single.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#222222"
android:orientation="vertical"
android:padding="10dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#E6E6E6"
android:orientation="vertical" >
<ImageView
android:id="@+id/grid_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/eleven" >
</ImageView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="vertical" >
<TextView
android:id="@+id/grid_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="Text"
android:textSize="12sp" >
</TextView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<GridView
android:id="@+id/grid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:listSelector="#00000000"
android:numColumns="auto_fit" />
</LinearLayout>
尝试将您的ImageView xml更改为此:
<ImageView
android:id="@+id/grid_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:scaleType="fitXY"
android:src="@drawable/eleven" >
</ImageView>
您可以很好地了解各种不同的android:scaleType
显示器,以及它们在此处的行为。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句