2016-11-13 3 views
1

Ich bin ein Neuling in Android-Entwicklung. Der Versuch, Button und ImageView in FrameLayout einzufügen, sie sind jedoch unsichtbar (sie sind im Layout vorhanden, aber nicht gezeichnet).Elemente in FrameLayout sind unsichtbar

Mein Layout:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/OuterFrame" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:foreground="@drawable/flb1_off"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/show_dialog" 
     android:id="@+id/showDialogBtn" 
     android:onClick="showDialog" 
     android:layout_gravity="center" 
     android:background="#123456" 
     android:textColor="@color/abc_background_cache_hint_selector_material_dark" 
     android:visibility="visible" /> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/flb" 
     android:layout_gravity="bottom" 
     android:contentDescription="@string/content_desc" /> 

</LinearLayout> 

Die api Version ist 19. Das Interessante daran ist, dass Button clickhandler ok funktioniert, aber Button selbst ist unsichtbar.

Ich legte alle Kinder auf Einzelkinder sehen, wie erwähnt here, aber ohne Erfolg.

Was mache ich falsch?

+2

Ich denke 'android: Vordergrund =" @ Drawable/flb1_off "' ist das Problem. –

+0

@SHAHMDMONIRULISLAM, Sie haben Recht! Substitution android: Vordergrund zu android: Hintergrund repariert es! – Nicolas

+0

Ich habe eine Antwort hinzugefügt. Kannst du es bitte akzeptieren? @Nicolas –

Antwort

0

Ihr Problem aus dieser Linie kommt:

android:foreground="@drawable/flb1_off" 

Sie müssen es ändern.