5 keyboard layout android admob android-edittext
我一直遇到麻烦,让adMob横幅沿着软键盘滚动并覆盖我的文字视图....
这是我在Android中尝试实现的链接:http://bit.ly/myfoodcalc
我知道我的布局有点复杂,嵌套视图太多(可能)等等.
我试图改变Manifest上的东西但没有成功.
为了让你更好地理解它,这里是son伪XML(以及帖子后面的完整XML)......
<ScrollView>
<Linear layout>
<ImageView>
<TableView>
<Several rows with a Edit Text widget>
</TableView>
</ImageView>
</LinearLayout>
</ScrollView>
<FrameLayout>
<ImageView>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的完整XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/relativeLayout"
android:background="@drawable/backgroundwithtext">
<ScrollView android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center_horizontal">
<ImageView android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:src="@drawable/icon"
android:layout_height="wrap_content"></ImageView>
<TableLayout android:id="@+id/tableLayout1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/backgroundsmallobj">
<TableRow android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:text="TITLE"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView1">
</TextView>
</TableRow>
<TableRow android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText android:text="EditText"
android:maxLines="1"
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:imeOptions="actionNext">
</EditText>
</TableRow>
<TableRow android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText android:text="EditText"
android:maxLines="1"
android:id="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:imeOptions="actionNext">
</EditText>
</TableRow>
<TableRow android:id="@+id/tableRow4" android:layout_width="wrap_content" android:layout_height="wrap_content">
<EditText android:text="EditText"
android:maxLines="1"
android:id="@+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:imeOptions="actionNext">
</EditText>
</TableRow>
<TableRow android:id="@+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText android:text="EditText"
android:maxLines="1"
android:id="@+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:imeOptions="actionNext">
</EditText>
</TableRow>
<TableRow android:id="@+id/tableRow6" android:layout_width="wrap_content" android:layout_height="wrap_content">
<EditText android:text="EditText" android:maxLines="1" android:id="@+id/editText6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:imeOptions="actionDone"></EditText>
</TableRow>
<TableRow android:id="@+id/tableRow7" android:layout_width="wrap_content" android:layout_height="wrap_content">
<Button android:id="@+id/button1" android:layout_height="wrap_content" android:text="Button" android:layout_width="wrap_content"></Button>
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
<FrameLayout android:id="@+id/frameLayout1"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent">
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adUnitId="############"
ads:adSize="BANNER"
ads:loadAdOnCreate="true" />
</FrameLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
Ela*_*ava 17
您可以更改键盘在广告上显示时的行为方式.转到AndroidManifest.xml并使用AdMob横幅在activity标记中添加此属性.
android:windowSoftInputMode="adjustPan"
Run Code Online (Sandbox Code Playgroud)
这样可以防止广告跳到键盘上方并隐藏输入.相反,它们将出现在键盘后面(隐藏).我不知道这是否违反AdMob政策,我只是提供解决方案.
| 归档时间: |
|
| 查看次数: |
6617 次 |
| 最近记录: |