2016-10-03 9 views
0

gidLayoutに問題があります。グリッドレイアウト要素の問題

enter image description here

これは、それはアンドロイドスタジオでどのように見えるかです:私はこのグリッドを持っています。しかし、タブレットにアプリをインストールすると、すべての要素が悪く見えます。

すべての要素は、行と列に正しく配置されますが、背景は接触しません。 layout_columnWeightとlayout_rowWeightが動作しないような... 200℃のテキスト要素を参照してください:あなたはlayout_width=wrap_contentを設定する必要が

<GridLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:columnCount="12" 
      android:rowCount="12" 
      android:background="@color/black" 
      android:layout_weight="1" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentStart="true"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Barra notificacions" 
       android:id="@+id/textView" 
       android:layout_row="0" 
       android:layout_column="0" 
       android:layout_rowWeight="1" 
       android:layout_columnWeight="1" 
       android:gravity="center_vertical|center_horizontal" 
       android:background="@color/fondoGrid" 
       android:layout_margin="1dp" 

       android:layout_gravity="fill_horizontal" 
       android:layout_columnSpan="7" /> 
...other textViews 
+0

あなたは ' kujeensiti

+0

を試しましたか?はい、この場合、すべての要素には画面のwithがあります。 – WIngenia

答えて

0

enter image description here

グリッドレイアウトとxml内のすべての要素のコードをグリッドレイアウト上に表示されます。これで問題は解決します。 私も同様の問題がありました。しかし、私のgridlayoutはフレームレイアウトの中に含まれていたので、両方でwrap_contentに幅を設定しなければなりませんでした。

関連する問題