0

私は、下部に配置する必要がある2つのボタンがあるAndroidアプリを実行しています。キーボードがポップアップすると、キーボードのレイアウトの上に移動して、ページの下部に戻る必要があります。どのように?

4

2 に答える 2

0

常に画面上部に表示したい場合は、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>
于 2011-08-30T18:00:28.367 に答える
0

AndroidManifestandroid:windowSoftInputModeの要素の属性を見てください。activity私のアプリケーションでは、次のコードを使用します。

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

行に注意してくださいandroid:windowSoftInputMode="adjustResize"。詳細はこちら: http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

于 2011-08-30T13:40:29.497 に答える