G;day mate,
FrameLayouts are usually only used forshowing one item at a time. You
can layout multiple views, but they will all be laid on top of each
other. There is a use for this, but I suspect not for your description
of the problem.
I would use a RelativeLayout - they make my life so much easier. With
a relative layout you can specify that:
- the RelativeLayout is to take up the entire screen
(layout_height="fill_parent", etc)
- the header is to stay at the top (alignParentTop=true)
- the footer / navigation bar is to stay at the bottom (alignParentBottom=true)
- the listview is to take up all the rest of the space
(layout_below="@+id/header" , layout_above="@+id/footer",
layout_height="fill_parent")
I noticed you used "alignParentBottom" in your last layout - maybe you
intended to use a RelativeLayout instead.
Also, if you plan to make more than one screen with this pattern, I
would put the title bar and the navigation into separate layouts and
then include them in the main layout.
For example:
<RelativeLayout
android:layout_height="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout android:id="@+id/header" android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal" style="@android:style/ButtonBar">
<ImageView android:src="@drawable/person"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:text="@string/personstring"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<ListView android:visibility="visible" android:id="@android:id/list"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_below="@+id/header" android:layout_above="@+id/footer" />
<LinearLayout android:id="@+id/footer"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="horizontal
style="@android:style/ButtonBar">
<ImageButton android:id="@+id/loacreation.previousButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" android:src="@drawable/buttonarrowleft" />
<ImageButton android:id="@+id/loacreation.nextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/buttonarrowright" />
</LinearLayout>
</RelativeLayout>
On Thu, Mar 3, 2011 at 3:37 AM, Patrick <[email protected]> wrote:
> Hallo!
>
> I want to create a Wizzard like layout which should look like described:
> * at the top should be some kind of title of the current dialog
> * at the bottom should be a navigation bar containg buttons for
> next/previous and various operations. THis bar should always(!) be at the
> very bottom of the screen.
> * at the center should be a list (should use all the space left, except the
> title bar and the navigation bar described above)
>
> My first attempt is posted below. I used framelayout however I was told this
> is a bad idea. The problem I ran into is that last row of my list is below
> the bar with the buttons at the bottom of the screen. Do you have any
> suggestions on how I could solve my Problem?
>
> Thanks
>
> Here's my not working draft:
>
> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
> android:orientation="vertical" android:layout_width="fill_parent"
> android:layout_height="fill_parent">
>
> <LinearLayout android:layout_width="fill_parent"
> android:layout_height="wrap_content" android:orientation="vertical"
>>
>
> <LinearLayout android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> android:orientation="horizontal" style="@android:style/ButtonBar">
>
> <ImageView android:src="@drawable/person"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content" />
>
> <TextView android:text="@string/personstring"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:textStyle="bold"
> android:textAppearance="?android:attr/textAppearanceLarge" />
>
> </LinearLayout>
>
>
> <ListView android:visibility="visible" android:id="@android:id/list"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent" />
>
>
> </LinearLayout>
> <LinearLayout android:id="@+id/footer"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> android:orientation="horizontal"
> android:layout_gravity="bottom|center"
> android:layout_alignParentBottom="true"
> style="@android:style/ButtonBar">
>
> <ImageButton android:id="@+id/loacreation.previousButton"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:layout_weight="1"
> android:src="@drawable/buttonarrowleft" />
>
> <ImageButton android:id="@+id/loacreation.nextButton"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:layout_weight="1"
> android:src="@drawable/buttonarrowright" />
> </LinearLayout>
>
>
> </FrameLayout>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en