У меня есть следующий файл макета, который имеет 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 больше, поэтому он соответствует размеру экрана, и у меня нет неиспользуемого белого пространства в нижней части дисплея?
Это отлично работает в эмуляторе, но на устройстве разрешение экрана составляет выше, поэтому внизу появляется пустое пространство.
Большое спасибо