GridLayout не подходит - PullRequest
       90

GridLayout не подходит

1 голос
/ 16 июня 2020

Я использую этот GridLayout, который работает на api 26, но когда я пробую на телефоне 22 api, он показывает только панель навигации и пустой экран. Я использую эту зависимость для cardview

implementation 'com.google. android .material: material: 1.1.0'

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">


        <GridLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:alignmentMode="alignMargins"
            android:columnCount="2"
            android:padding="16dp"
            android:rowCount="3">

            <androidx.cardview.widget.CardView
                android:id="@+id/ortho_docs"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_rowWeight="1"
                android:layout_columnWeight="1"
                android:layout_marginStart="16dp"
                android:layout_marginEnd="16dp"
                android:layout_marginBottom="16dp"
                android:foreground="?android:attr/selectableItemBackground"
                app:cardCornerRadius="8dp"
                app:cardElevation="5dp">

                <LinearLayout style="@style/grid_cards">
                    <ImageView
                        android:layout_width="60dp"
                        android:layout_height="60dp"
                        android:layout_gravity="center_horizontal"
                        android:src="@drawable/ic_orthopedics" />
                    <TextView
                        style="@style/dept_headers"
                        android:text="@string/ortho" />
                </LinearLayout>
            </androidx.cardview.widget.CardView>
</GridLayout>


    </RelativeLayout>

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/navigation_header"
        app:itemIconTint="@color/colorPrimary"
        app:menu="@menu/menu">
    </com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>

1 Ответ

0 голосов
/ 16 июня 2020

попробуйте использовать androidx.gridlayout.widget.GridLayout

Возможно, вам придется добавить это в свой gradle implementation 'androidx.gridlayout:gridlayout:1.0.0-rc01'

...