7

I had a TitleBar(#lotTopTitleBar) in the LinearLayout, and the LinearLayout will be full size of the screen, now, I want show a View(#lotFloatView) reference the TitleBar below, but both view aren't at the same level container, so the layout_below doesn't work, if anybody know about that, please help me a change.

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

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

        <LinearLayout android:id="@+id/lotTopTitleBar"
                      android:layout_width="match_parent"
                      android:layout_height="50dp">
        </LinearLayout>

        <LinearLayout android:layout_width="match_parent"
                      android:layout_height="0dp"
                      android:layout_weight="1">
        </LinearLayout>

        <LinearLayout android:layout_width="match_parent"
                      android:layout_height="50dp">
        </LinearLayout>

    </LinearLayout>

    <LinearLayout android:id="@+id/lotFloatView"
                  android:layout_width="120dp"
                  android:layout_height="wrap_content"
                  android:layout_below="@id/lotTopTitleBar">
        <Button android:layout_width="match_parent"
                android:layout_height="60dp"
                android:background="@null" />
        <Button android:layout_width="match_parent"
                android:layout_height="60dp"
                android:background="@null" />
    </LinearLayout>

</RelativeLayout>
sandrstar
  • 12,503
  • 8
  • 58
  • 65
VinceStyling
  • 3,707
  • 3
  • 29
  • 44
  • I figure it out by use PopupWindow, for detail, check http://stackoverflow.com/questions/7450959/how-to-show-popupwindow-at-special-location – VinceStyling Oct 27 '13 at 08:42

1 Answers1

6

I think you can achieve this by using relative layout instead of linear layout. I have not tested it but it should work.

    <RelativeLayout android:layout_width="match_parent"
              android:layout_height="match_parent"
              >

       <LinearLayout android:id="@+id/lotTopTitleBar"
                  android:layout_width="match_parent"
                  android:layout_height="50dp">
    </LinearLayout>
    <LinearLayout android:id="@+id/lotFloatView"
              android:layout_width="120dp"
              android:layout_height="wrap_content"
              android:layout_below="@id/lotTopTitleBar">
    <Button android:layout_width="match_parent"
            android:layout_height="60dp"
            android:background="@null" />
    <Button android:layout_width="match_parent"
            android:layout_height="60dp"
            android:background="@null" />
</LinearLayout>

    <LinearLayout android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_below="@id/lotTopTitleBar"
                  android:id="@+id/lotLL"
                  android:layout_weight="1">
    </LinearLayout>

    <LinearLayout android:layout_width="match_parent"
                  android:layout_below="@id/lotLL"
                  android:layout_height="50dp">
    </LinearLayout>

</RelativeLayout >

EDIT

    <LinearLayout android:layout_width="match_parent"
                  android:layout_below="@id/lotLL"
                  android:layout_alignParentBottom="true"
                  android:id="@+id/lotLastLL"
                  android:layout_height="50dp">
    </LinearLayout>

    <LinearLayout android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_below="@id/lotTopTitleBar"
                  android:layout_above="@id/lotLastLL"
                  android:id="@+id/lotLL"
                  >
    </LinearLayout>
Tarun
  • 13,727
  • 8
  • 42
  • 57
  • I don't think I could use "layout_weight" in RelativeLayout, as you write, the "#lotLL" haven't any size. – VinceStyling Jul 15 '13 at 06:41
  • correct.. i didnt look at that.. All i wanted to show is how you can change the LL to RL – Tarun Jul 15 '13 at 07:20
  • LinearLayout **#lotLastLL** cannot declare "layout_below=@id/lotLL" if id=lotLL didn't define, the Intellij IDEA had an error report like this "android-apt-compiler Error: No resource found that matches the given name (at 'layout_below' with value '@id/lotLL')." @Tarun – VinceStyling Jul 15 '13 at 10:04
  • I use PopupWindow solved this problem, I think I should let you know – VinceStyling Oct 27 '13 at 08:45