2011-08-30 69 views
0

我正在做一个Android应用程序,我应该在底部放置两个按钮,当弹出键盘时,他们需要移动到键盘布局的上方,再次返回到底部页。怎么样?如何在页面布局中移动页脚

回答

0

查看AndroidManifest中activity元素的android:windowSoftInputMode属性。在我的应用程序中,我使用此代码:

<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

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>