0

グリッドビューに関して LinearLayout の内容を揃えたい。次のカレンダー レイアウトにおける日 (つまり、日、月など) の間のギャップは、グリッドビュー スペース (1,2..30) に等しい必要があります。その日の背景画像は避けるべきです。

レイアウト コード:

<?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"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2.5"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal" >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:background="@drawable/arrow_left" />
        </LinearLayout>

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1.5"
            android:gravity="center"
            android:orientation="horizontal"
            android:text="hello world"
            android:textColor="#000000"
            android:textSize="18dip"
            android:textStyle="bold" >
        </TextView>

        <LinearLayout
            android:id="@+id/next"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal" >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:background="@drawable/arrow_right" />
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/previous"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1.4"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal"
            android:text="Sun"
            android:textColor="#000000" >
        </TextView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal"
            android:text="Mon"
            android:textColor="#000000" >
        </TextView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal"
            android:text="Tue"
            android:textColor="#000000" >
        </TextView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal"
            android:text="Wed"
            android:textColor="#000000" >
        </TextView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal"
            android:text="Thu"
            android:textColor="#000000" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal"
            android:text="Fri"
            android:textColor="#000000" >
        </TextView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal"
            android:text="Sat"
            android:textColor="#000000" >
        </TextView>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="20"
        android:orientation="vertical" >

        <GridView
            android:id="@+id/gridview"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center_horizontal"
            android:listSelector="@android:color/black"
            android:numColumns="7"
            android:stretchMode="columnWidth" />
    </LinearLayout>

</LinearLayout>
4

1 に答える 1