views:

259

answers:

3

i want set my footer at the top layer of my app. it should not have any shakes and moves while the activity navigation or showing up the keyboard. it should always settled in the bottom of the screen. how to do that? any ideas plz.

+1  A: 

Set your root layout node to be a RelativeLayout. Wrap your main application content to be a LinearLayout as normal, and wrap your footer content in a layout with attribute android:layout_alignParentBottom="true" set.

Jim Blackler
its not working....
Praveen Chandrasekaran
+2  A: 

it should not have any shakes and moves while the activity navigation or showing up the keyboard. it should always settled in the bottom of the screen.

That is not possible, sorry.

CommonsWare
i saw a university of nebraska app for iphone. they use a footer always at the bottom. why not in android we can't do that??? i wanna develop my app like that? i think my English is a problem to u. so can u see that free app in iphone. and give me some suggestions plz...
Praveen Chandrasekaran
"why not in android we can't do that?" The soft keyboard is more important than your footer. Hence, either the soft keyboard will appear over top of your footer or it will cause your footer to slide up the screen, depending on your settings (see http://developer.android.com/resources/articles/on-screen-inputs.html).
CommonsWare
okay. why we cant do that while activity navigation???
Praveen Chandrasekaran
If you disable inter-activity animations for your application, you *may* get the effect you want. I have not tried this and so I do not know if it will meet your needs. See http://developer.android.com/reference/android/app/Activity.html#overridePendingTransition%28int,%20int%29
CommonsWare
thanks a lot for your support and encouragement Mark..
Praveen Chandrasekaran
i think the overridePendingTransition() is used to set an animation between activity navigation. we can't do anything for the layouts
Praveen Chandrasekaran
Correct, but if layout of Activity A has your footer and the layout of Activity B has your footer, and if there is no animation between them, the visual effect *might* be what you want. Again, I have no tried this and do not know if it will meet your needs.
CommonsWare
okay. i shall try it and let u know..
Praveen Chandrasekaran
yes it works. but without animation its not good looking. thanks a lot Mark.
Praveen Chandrasekaran
A: 

You can do that. I tried that and its working.. the keyboard is hiding my footer..

Here I am pasting my code snippet..

 <RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"&gt;    
<LinearLayout android:layout_width="fill_parent"
    android:orientation="vertical" android:layout_below="@+id/top_layout"
    android:id="@+id/control_layout" android:layout_height="fill_parent"
    android:layout_centerVertical="true" android:layout_centerHorizontal="true"
    android:background="@drawable/bg" android:fadingEdge="horizontal|vertical"
    android:fitsSystemWindows="true">
    <EditText android:layout_width="wrap_content"
        android:textStyle="normal" android:typeface="serif"
        android:imeOptions="actionDone|flagNoEnterAction" android:textSize="14sp"
        android:text="Enter TExt here"
        android:isScrollContainer="true" android:scrollHorizontally="false"
        android:layout_height="fill_parent" android:layout_marginBottom="45dip"
        android:scrollbarStyle="insideInset" android:id="@+id/edit_text"
        android:background="@android:color/transparent" android:gravity="top"
        android:paddingBottom="1dip" android:paddingLeft="2dip"
        android:paddingRight="1dip" android:paddingTop="1dip" android:visibility="visible"></EditText>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
    android:orientation="vertical" android:id="@+id/main_layout"
    android:gravity="bottom" android:isScrollContainer="true"
    android:layout_height="wrap_content" android:layout_alignParentBottom="true">
    <LinearLayout android:id="@+id/bottom_panel"
        android:layout_height="wrap_content" android:orientation="horizontal"
        android:layout_width="fill_parent" android:background="@drawable/bottom_panel_bg">
        <Button android:layout_width="wrap_content" android:text="Explore"
            android:background="@drawable/explore" android:layout_gravity="center_vertical"
            android:id="@+id/explore_text" android:textColor="#FFFFFF"
            android:gravity="bottom" android:paddingRight="1dip"
            android:layout_height="fill_parent" android:textColorHighlight="#FFFFA6"
            android:typeface="serif" android:layout_marginLeft="5dip"></Button>
        <Button android:layout_width="wrap_content" android:id="@+id/search_text"
            android:background="@drawable/btn_search" android:gravity="bottom"
            android:text="Search" android:textColor="#FFFFFF"
            android:layout_height="fill_parent" android:typeface="serif"
            android:layout_marginLeft="11dip"></Button>
        <Button android:layout_width="wrap_content" android:id="@+id/fav_text"
            android:text="Favorite" android:background="@drawable/favorites_text"
            android:gravity="bottom" android:textColor="#FFFFFF"
            android:layout_height="fill_parent" android:typeface="serif"
            android:layout_marginLeft="10dip"></Button>
        <Button android:layout_width="wrap_content" android:text="My Data"
            android:id="@+id/my_text" android:background="@drawable/my_texts"
            android:gravity="bottom" android:textColor="#FFFFFF"
            android:layout_height="fill_parent" android:typeface="serif"
            android:layout_marginLeft="11dip"></Button>
        <Button android:id="@+id/about_us" android:background="@drawable/about_us"
            android:gravity="bottom" android:textColor="#FFFFFF"
            android:layout_gravity="center_horizontal" android:text="About"
            android:layout_height="fill_parent" android:textColorHighlight="#FFFFA6"
            android:layout_width="wrap_content" android:typeface="serif"
            android:layout_marginLeft="11dip"></Button>
    </LinearLayout>
</LinearLayout>

Check whether it help you or not

sachin