我有以下布局文件,其背后有一个GridView
和一个作为背景。ImageView
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginRight="-70dp"
android:layout_marginBottom="-50dp"
android:src="@drawable/s_background"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="90dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center"/>
</LinearLayout>
</FrameLayout>
这是我在网格的每个“单元格”中用于实际项目的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/cardInGrid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:singleLine="true"
android:textSize="40sp"
android:textColor="#660099"
android:typeface="serif"/>
</LinearLayout>
我现在在我的设备上看到以下内容:
有没有办法让 GridView 中的每个项目都变大,这样它就适合屏幕的大小,而且我在显示器的底部没有未使用的空白?
这在模拟器上运行良好,但在设备上屏幕分辨率更高,因此在底部获得空白。
非常感谢