2016-03-23 7 views
1

Androidでlayer-list xmlを使用してカスタムレイアウトを作成しました。しかし、私は層リストのために行って、私が欲しいものを正確に見ています。しかし、私のレイアウトで申し込むと、正確には何が欲しいのかわかりません。理由はわかりません。私を助けてください!レイヤリストxmlを使用したカスタムレイアウトは正確ではありません

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
<item> 
    <shape android:shape="rectangle"> 
     <size 
      android:width="@dimen/dp35" 
      android:height="@dimen/dp35" /> 
     <solid android:color="@color/colorAccent" /> 
    </shape> 
</item> 
<item android:right="12dp" 
    android:top="@dimen/dp20" 
    android:bottom="-5dp"> 
    <rotate 
     android:fromDegrees="25"> 
     <shape android:shape="rectangle"> 
      <solid android:color="@color/colorAccent" /> 
     </shape> 
    </rotate> 
</item> 
<item android:left="12.5dp" 
    android:top="@dimen/dp20" 
    android:bottom="-5dp"> 
    <rotate 
     android:fromDegrees="-25"> 
     <shape android:shape="rectangle"> 
      <solid android:color="@color/colorAccent" /> 
     </shape> 
    </rotate> 
</item> 

Preview 1

層-たList.xmlを使用して私のレイアウトは

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 
    <TextView 
     android:layout_width="100dp" 
     android:layout_height="100dp" 
     android:background="@drawable/bg_sale_off" 
     android:text="Textview" 
     android:layout_centerInParent="true" /> 

</RelativeLayout> 

Preview 2 (without triangle at bottom)

答えて

0

あなたが

を試すことができます: これは私の層、List.xmlのです

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 
    android:layout_width="match_parent" 
 
    android:layout_height="match_parent" 
 
    android:orientation="vertical"> 
 
    <TextView 
 
     android:layout_width="wrap_content" 
 
     android:layout_height="wrap_content" 
 
     android:background="@drawable/bg_sale_off" 
 
     android:text="Textview" 
 
     android:layout_centerInParent="true" /> 
 

 
</RelativeLayout>

+0

すぐにあなたの答えに感謝。しかし、それは私を助けません。 – TedVN

関連する問題