隐藏所有键盘 android [带广告横幅]
hide all keyboards android [with ads banner]
我创建了一个应用程序,其中我有一个 inputText 并且输入类型是 deciaml 数字。
当我点击这个输入时,我会显示正确的键盘,一旦我按下确定,我会自动获得普通键盘:
这是布局文件的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
android:background="@color/whiteSmoke"
tools:context="com.habchi.soldecalculator.MainActivity">
<!-- Floating Solde Buttons -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:gravity="bottom">
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>
</LinearLayout>
我不得不说我删除广告横幅时没有这个问题。
只是好奇,您会尝试将 android:focusable="false"
添加到您的 AdView XML 吗?我想知道键盘是否会出现,因为 AdView 能够获得应用焦点。
找到答案。必须将 android:imeOptions="actionDone" 添加到 edittext
我创建了一个应用程序,其中我有一个 inputText 并且输入类型是 deciaml 数字。 当我点击这个输入时,我会显示正确的键盘,一旦我按下确定,我会自动获得普通键盘:
这是布局文件的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
android:background="@color/whiteSmoke"
tools:context="com.habchi.soldecalculator.MainActivity">
<!-- Floating Solde Buttons -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:gravity="bottom">
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>
</LinearLayout>
我不得不说我删除广告横幅时没有这个问题。
只是好奇,您会尝试将 android:focusable="false"
添加到您的 AdView XML 吗?我想知道键盘是否会出现,因为 AdView 能够获得应用焦点。
找到答案。必须将 android:imeOptions="actionDone" 添加到 edittext