Drawable-Form nicht zeigen, wenn verwendet, in Kombination mit android:drawableBottom Attribut.

XML-Datei gespeichert res/drawable/gradient_box.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:startColor="#FFFF0000"
        android:endColor="#80FF00FF"
        android:angle="45"/>
    <padding android:left="7dp"
        android:top="7dp"
        android:right="7dp"
        android:bottom="7dp" />
    <corners android:radius="8dp" />
</shape>

(Die oben genannten Form-definition ist entnommen aus als Android developer guide. Es gibt keine Fehler darin.).

Lassen Sie uns versuchen, es zu benutzen zusammen mit einem TextView:

<TextView 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:text="Text with some crazy rectangle shape below it."
    android:drawableBottom="@drawable/gradient_box"/>   

Den TextView angezeigt, wenn die drawableBottom Attribut war nicht da! Jedoch, die Einstellung der Form als hintergrund ganz gut funktioniert:

<TextView 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:text="Text with crazy background"
    android:background="@drawable/gradient_box"/>

Einstellung ein Bild (z.B. ein *.png -), die android -: drawableBottom funktioniert auch einwandfrei.

Irgendwelche Ideen?

InformationsquelleAutor Håvard Geithus | 2011-07-28

Schreibe einen Kommentar