0

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

2 Answers 2

0

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

0

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.