开发者

how to set a footer at top layer of the app in android?

开发者 https://www.devze.com 2022-12-24 06:22 出处:网络
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 th开发者_运维百科e bottom

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 th开发者_运维百科e bottom of the screen. how to do that? any ideas plz.


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号