1

I am a newbie in Android development. Trying to put Button and ImageView inside FrameLayout, but they are invisible (they do exist on the layout, but not drawn).

My 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>

The api version is 19. The interesting thing is that button clickHandler works ok, but button itself is invisible.

I put all children to single child view, as mentioned here, but without success.

What I'm doing wrong?

Community
  • 1
  • 1
Nicolas
  • 74
  • 11

2 Answers2

0

Substitution android:foreground to android:background fixed it, as SHAH MD MONIRUL ISLAM offered.

Community
  • 1
  • 1
Nicolas
  • 74
  • 11
0

Your problem is coming from this line:

android:foreground="@drawable/flb1_off"

You need to change it.

Tushar Monirul
  • 4,944
  • 9
  • 39
  • 49