2016-03-23 11 views
1

Ich benutzerdefinierte mein Layout mit Layer-Liste Xml in Android. Aber ich habe für Layer-Liste getan und sehe genau das, was ich anpassen möchte. Aber wenn ich mich in meinem Layout bewerbe, zeigt es nicht genau, was ich will, ich weiß nicht warum. Bitte hilf mir! Dies ist meine Schicht-list.xml:Benutzerdefiniertes Layout mit Layer-Liste xml nicht genau

<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

Mein Layout mit Layer-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)

Antwort

0

Sie

versuchen können,

<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

danken schnell für Ihre Antwort. Aber es hilft mir nicht. – TedVN