2017-01-20 1 views
0

Ich machte eine activity, die meine benutzerdefinierte dialog als Thema verwendet. Ich habe meine drawable mit abgerundeten Ecken auf die activity's äußerste PercentRelativeLayout angewendet, aber die Ecken sind clipping. Hier ist meine Gewohnheit dialog in styles.xmlAndroid Studio Ausschnitt Ecken im Dialogfeld

<style name="myCustomDialog" parent="Theme.AppCompat.Dialog"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
</style> 

Hier ist meine drawable

<?xml version="1.0" encoding="utf-8"?> 
<shape 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle"> 

<corners android:radius="5dp" /> 
<stroke 
    android:width="1dip" 
    android:color="#000" /> 
</shape> 

Hier ist meine activity in meinem manifest

<activity android:name=".activities.NotSavedActivity" 
       android:theme="@style/myCustomDialog"> 
    </activity> 

Wenn ich meine Tätigkeit beginnen, die Ecken sind Clipping als in den folgenden Bildern gezeigt

Hier

enter image description hereenter image description here

ist mein activity's xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:padding="15dp" 
android:background="@drawable/not_saved_module"> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Du har inte sparat, stäng ändå?" 
    android:id="@+id/notSavedTextView"/> 

<RelativeLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_below="@+id/notSavedTextView"> 
     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/yes" 
      android:text="Ja"/> 

     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/no" 
      android:text="Nej" 
      android:layout_toRightOf="@id/yes" 
      android:layout_toEndOf="@+id/yes"/> 
</RelativeLayout> 

</android.support.percent.PercentRelativeLayout> 

Antwort

0

Sie sehen, Sie sind kein Hintergrund in Ihrem ziehbar Einstellung. In der Tat ist Ihr Zeichen nur ein Strich mit Ecken. Versuchen Sie, eine bestimmte Füllfarbe ("solid" Attr) in Ihrem Zeichenfeld festzulegen, und Sie werden sehen, dass eigentlich alles in Ordnung ist. Dieser Hintergrund kommt von Theme.AppCompat.Dialog Thema.

Sets in Ihrem Thema so etwas wie dieses

<style name="myCustomDialog" parent="Theme.AppCompat.Dialog"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
    <item name="android:background">@android:color/transparent</item> 
</style> 

oder sogar

<item name="android:background">@drawable/not_saved_module</item> 

Aber in der 2. Variante, die Sie nicht brauchen, um es einrichten in activity XML dann

Verwandte Themen