我有一个带有图像和文本视图的网格布局。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@drawable/bg">
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="2"
android:columnWidth="90dp"
android:horizontalSpacing="10dp"
android:verticalSpacing="10dp"
android:gravity="center"
android:stretchMode="columnWidth" >
</GridView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:id="@+id/testheader"
android:gravity="center"
android:layout_alignParentBottom="true" >
</RelativeLayout>
</RelativeLayout>
布局:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_weight="20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp">
<ImageView
android:id="@+id/img"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:baselineAlignBottom="false"
android:visibility="visible"
android:layout_gravity="center"
android:textAlignment="center">
</ImageView>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:id="@+id/txt"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="101dp"
android:textStyle="bold"
android:textColor="#3a08ff"
android:textSize="10dip" />
</RelativeLayout>
当我在小屏幕尺寸的设备中查看它时,似乎没有问题。但是,当我在较大的设备中查看相同的图像时,图像视图看起来很小。我该如何克服呢?
使用imageview的ScaleType属性将其保留为
Scaletype="fitXY"
希望它会为你工作
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句