как переместить нижний колонтитул вверх и вниз в макете - PullRequest
0 голосов
/ 30 августа 2011

Я делаю приложение для Android, где у меня есть две кнопки, которые должны быть расположены внизу, и когда клавиатура всплывает, они должны переместиться над раскладкой клавиатуры и снова вернуться к нижней части страницы. Как?

Ответы [ 2 ]

0 голосов
/ 30 августа 2011

Если вы всегда хотите отображать в верхней части экрана, то вы можете рассмотреть возможность использования 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 голосов
/ 30 августа 2011

Посмотрите на атрибут android:windowSoftInputMode элемента activity в вашем AndroidManifest.В моем приложении я использую этот код:

<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

...