网格布局不显示

时间:2018-08-06 04:40:47

标签: android android-layout android-gridlayout

我创建了一个Grid Layout UI并成功创建了一个问题,但是问题是,在OPPO之类的手机中,UI不支持它,什么也没显示,我不知道为什么会这样。 除OPPO之外,所有手机均支持此UI,我不知道为什么会这样。请帮帮我解决这个问题。 XML代码

<LinearLayout
    android:orientation="vertical"
    android:background="@drawable/bg"
    android:weightSum="10"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <GridLayout
        android:id="@+id/mainGrid"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="8"
        android:alignmentMode="alignMargins"
        android:columnCount="2"
        android:columnOrderPreserved="false"
        android:padding="14dp"
        android:rowCount="3">

        <!-- Row 1 -->

        <!-- Column 1 -->
        <android.support.v7.widget.CardView
            android:id="@+id/firstyear"
            android:layout_width="0dp"
            android:layout_height="15dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="153dp"
                    android:layout_height="49dp"
                    android:layout_gravity="center_horizontal"
                    android:src="@drawable/ic_book_306468_960_720" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="First Year"
                    android:textAlignment="center"
                    android:textColor="@android:color/black"
                    android:textSize="18sp"
                    android:textStyle="bold" />

            </LinearLayout>

        </android.support.v7.widget.CardView>

        <!-- Column 2 -->
        <android.support.v7.widget.CardView
            android:id="@+id/secondyear"
            android:layout_width="0dp"
            android:layout_height="15dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="153dp"
                    android:layout_height="54dp"
                    android:layout_gravity="center_horizontal"
                    android:src="@drawable/ic_second_year" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Second Year"
                    android:textAlignment="center"
                    android:textColor="@android:color/black"
                    android:textSize="18sp"
                    android:textStyle="bold" />

            </LinearLayout>

        </android.support.v7.widget.CardView>


        <!-- Row 2 -->

        <!-- Column 1 -->
        <android.support.v7.widget.CardView
            android:id="@+id/thirdyear"
            android:layout_width="0dp"
            android:layout_height="15dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="153dp"
                    android:layout_height="54dp"
                    android:layout_gravity="center_horizontal"
                    android:src="@drawable/ic_third_year" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Third Year"
                    android:textAlignment="center"
                    android:textColor="@android:color/black"
                    android:textSize="18sp"
                    android:textStyle="bold" />

            </LinearLayout>

        </android.support.v7.widget.CardView>

        <!-- Column 2 -->
        <android.support.v7.widget.CardView
            android:id="@+id/download"
            android:layout_width="0dp"
            android:layout_height="15dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="153dp"
                    android:layout_height="54dp"
                    android:layout_gravity="center_horizontal"
                    android:src="@drawable/ic_file_download_black_24dp" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Download"
                    android:textAlignment="center"
                    android:textColor="@android:color/black"
                    android:textSize="18sp"
                    android:textStyle="bold" />


            </LinearLayout>

        </android.support.v7.widget.CardView>


    </GridLayout>

</LinearLayout>

定位

 08-06 10:19:25.222 10389-10632/com.software.aj.bcomstudyguide E/ACodec: 
 cannot find aac bit rate
08-06 10:19:41.683 10389-10389/com.software.aj.bcomstudyguide E/Parcel: 
Reading a NULL string not supported here.
08-06 10:19:43.567 10389-10465/com.software.aj.bcomstudyguide E/Parcel: 
Reading a NULL string not supported here.
08-06 10:19:43.575 10389-10465/com.software.aj.bcomstudyguide E/Parcel: 
 Reading a NULL string not supported here.
08-06 10:19:43.611 10389-10465/com.software.aj.bcomstudyguide E/Parcel: 
Reading a NULL string not supported here.
08-06 10:19:43.650 10389-10465/com.software.aj.bcomstudyguide E/Parcel: 
Reading a NULL string not supported here.
08-06 10:19:47.215 10389-10443/com.software.aj.bcomstudyguide E/SQLiteLog: 
(14) cannot open file at line 30202 of [00bb9c9ce4]
 08-06 10:19:47.528 10389-10766/com.software.aj.bcomstudyguide E/ACodec: 
 cannot find aac bit rate

Other Phones OPPO Phone

0 个答案:

没有答案