Search code examples
androidlayoutviewparentchildren

Android Layout: cannot see the children over the parent


I have the Layouts as you can see in the picture (sorry I cannot post them normally yet): https://dl.dropboxusercontent.com/u/28640502/Unbenannt.bmp

However, when I execute the app I can only see the camera preview and not the text nor the SeekBar. I know they work, because when I reduce the size of the camera I can see them and interact, but if I want the camera to be like background and then the children over it, it doesn't work.

I have been checking a lot of threads with similar problems but I don't find the solution: 1, 2, 3... Any idea? Thanks a lot!

Here is my xml code just in case:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="0.55"
    android:orientation="vertical" >

    <FrameLayout
        android:id="@+id/camera_preview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/show_height"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="5sp"
                android:layout_marginRight="10sp"
                android:layout_weight="0.12"
                android:text="H" />

            <SeekBar
                android:id="@+id/select_height"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:layout_margin="5sp"
                android:layout_weight="0.91" />

            <TextView
                android:id="@+id/show_distance"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="0.06"
                android:text="Dist" />
        </LinearLayout>

    </FrameLayout>

</LinearLayout>

Solution

  • try to input both of your layouts in relative layout for example

    <LL>
      <RL>
        <FL>
        </FL>
        <LL>
        </LL>
      </RL>
    </LL>
    

    this is hapenning because of overlaiyng of LL by FL