开发者

how to move footer up nd down in layout

I am doing an android app where I have two buttons which should be placed in bottom and when key开发者_开发问答board pops up they need to move above the layout of keyboard and again go back to bottom of page. How?


Have a look at android:windowSoftInputMode attribute of the activity element in your AndroidManifest. In my application I use this code:

<activity android:name="MyActivity"
          android:label="@string/app_name"
          android:windowSoftInputMode="adjustResize"
          android:configChanges="orientation|keyboardHidden"
          android:launchMode="singleInstance"
          android:screenOrientation="portrait">

Note the android:windowSoftInputMode="adjustResize" line. Read more here: http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft


If you always want to display on top of the screen then you may want to consider using RelativeLayout.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<com.admob.android.ads.AdView
      android:id="@+id/ad" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"
      app:backgroundColor="#000000"
      app:primaryTextColor="#FFFFFF"
      app:secondaryTextColor="#CCCCCC"
      android:layout_alignParentTop="true"
    />

<!-- TextView below that -->

<TextView
android:id="@+id/widget28"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Input Amount:"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:layout_marginRight="10dip"
android:layout_below="@id/ad"
android:textSize="16dip"
android:textStyle="bold">
</TextView>

</RelativeLayout>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜