2017-12-24 20 views
1

응용 프로그램을 실행할 때 아래 레이아웃의 CardView가 표시되지 않습니다. build.gradle 파일에서 은 이미 GridLayoutAppCompat에 대한 종속성을 추가했습니다 : 또한android.support.v7.widget 응용 프로그램을 실행할 때 카드보기가 표시되지 않습니다.

implementation 'com.android.support:gridlayout-v7:26.1.0' 
implementation 'com.android.support:appcompat-v7:26.1.0' 

구글 메이븐을. 실행시 오류가 없습니다. 이것에 대한 이유는 무엇일까요? 미리 감사드립니다.^_ ^.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="#CFD8DC" 
     tools:context="com.example.ninjathegreat.ligaocitysolidwastemanagementv20.MainActivity"> 


     <LinearLayout 
      android:orientation="vertical" 
      android:weightSum="10" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <RelativeLayout 
       android:id="@+id/relativeID" 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:layout_weight="2" /> 

      <TextView 
       android:id="@+id/eswm" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/eswm" 
       android:layout_gravity="center" 
       android:textSize="34sp" /> 

      <GridLayout 
       android:id="@+id/mainGrid" 
       android:layout_width="match_parent" 
       android:layout_height="412dp" 
       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:layout_width="0dp" 
        android:layout_height="0dp" 
        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"> 


         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:drawableTop="@drawable/calendar_2" 
          android:padding="5dp" 
          android:text="@string/waste_schedule" 
          android:textAlignment="center" 
          android:textColor="#020202" 
          android:textStyle="bold" /> 

        </LinearLayout> 

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

       <android.support.v7.widget.CardView 
        android:layout_width="0dp" 
        android:layout_height="0dp" 
        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"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:drawableTop="@drawable/calendar_2" 
          android:padding="5dp" 
          android:text="@string/waste_schedule" 
          android:textAlignment="center" 
          android:textColor="#020202" 
          android:textStyle="bold" /> 


        </LinearLayout> 

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

       <android.support.v7.widget.CardView 
        android:layout_width="0dp" 
        android:layout_height="0dp" 
        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"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:drawableTop="@drawable/calendar_2" 
          android:padding="5dp" 
          android:text="@string/waste_schedule" 
          android:textAlignment="center" 
          android:textColor="#020202" 
          android:textStyle="bold" /> 


        </LinearLayout> 

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

       <android.support.v7.widget.CardView 
        android:layout_width="0dp" 
        android:layout_height="0dp" 
        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"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:drawableTop="@drawable/info" 
          android:padding="5dp" 
          android:text="@string/information_1" 
          android:textAlignment="center" 
          android:textColor="#020202" 
          android:textStyle="bold" /> 


        </LinearLayout> 

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

     </LinearLayout> 
    </ScrollView> 
+0

확인 하시겠습니까? – Munir

+0

픽셀 ap 21 선생님 –

답변

0

시도는 build.gradle 파일에 'com.android.support:gridlayout-v7:23.1.1'로 컴파일 및 지원을 GridLayout을 사용합니다. 아래와 같이

<android.support.v7.widget.GridLayout 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/container_grid" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:columnCount="2" 
    app:rowCount="3" 
    app:orientation="horizontal"> 

//your further layout 
</android.support.v7.widget.GridLayout>