arp*_*008 7 android android-softkeyboard android-toolbar
我在布局中使用了工具栏.每当我打开活动并专注于编辑文本时,它都会隐藏工具栏.请看下面的图片
下面是我的布局文件:
<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"
android:orientation="vertical"
tools:context="com.example.sampleactivity">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="4dp"
android:background="@color/color_theme"
android:minHeight="?attr/actionBarSize">
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="App"
android:textColor="@color/white"
android:textSize="24sp" />
<Button
android:id="@+id/past_locations"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Next"
android:textColor="@color/white"
style="?android:attr/borderlessButtonStyle"/>
</android.support.v7.widget.Toolbar>
<LinearLayout
android:id="@+id/mapLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<EditText
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:singleLine="true"
/>
<AutoCompleteTextView
android:id="@+id/tags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:maxLines="3"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
使用android:windowSoftInputMode="adjustPan"
也没有帮助.
键盘打开时如何避免隐藏我的工具栏.
arp*_*008 18
android:windowSoftInputMode="adjustResize"
在AndroidManifest.xml中添加解决了我的问题,例如:
<activity
android:name=".MainActivity"
android:label="@string/activity_main"
android:windowSoftInputMode="adjustResize">
</activity>
Run Code Online (Sandbox Code Playgroud)