2017-10-19 10 views
0

繰り返しているRelativeLayoutに背景としてパターンを持っています。レイヤーリストから色の背景を繰り返します

<RelativeLayout 
     android:layout_width="0dp" 
     android:layout_height="600dp" 
     android:layout_weight=".20" 
     android:background="@drawable/timetable_background" 
     android:tileMode="repeat" > 

しかし、tileModeは機能しません。実行は1回だけです。 これが私のパターンです:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 

    <item android:bottom="50dp" android:height="50dp"> 
     <shape android:shape="rectangle" > 
      <solid android:color="@color/timetableEntryBackground1" /> 
     </shape> 
    </item> 

    <item android:top="50dp" android:height="50dp"> 
     <shape android:shape="rectangle" > 
      <solid android:color="@color/timetableEntryBackground2" /> 
     </shape> 
    </item> 


</layer-list> 

私は背景が繰り返されることを、変更するには何が必要ですか?

+0

(https://stackoverflow.com/a/36764196/5015207 )を古いポストに戻す(背景としての繰り返しの形状を表示) – 0X0nosugar

答えて

0

あなたはこのように、あなたのlayer-listの項目内tileModeを使用する必要があります:あなたは私の[答え]を見て好きなら

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:bottom="50dp" android:height="50dp"> 
     <shape android:shape="rectangle" > 
      <solid 
       android:color="@color/timetableEntryBackground1" 
       android:tileMode="repeat" /> 
     </shape> 
    </item> 
    ... 
</layer-list> 
+0

これは動作しません、私はすでにこれをテストしました:( – KaiAlexander

関連する問題