我在布局中使用了工具栏.每当我打开活动并专注于编辑文本时,它都会隐藏工具栏.请看下面的图片
下面是我的布局文件:
<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"也没有帮助.
键盘打开时如何避免隐藏我的工具栏.
我正在尝试在底部实现自定义选项卡UI,就像Instagram一样(截图已附上).我希望中间选项卡打开另一个活动,而不是在同一视图中打开一个片段.

我觉得这是使用选项卡主机上的imagebutton overlay实现的.但是,我仍然无法正确放置该图像按钮,因此UI看起来很合适.下面是我底部标签的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<android.support.v4.app.FragmentTabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" />
</android.support.v4.app.FragmentTabHost>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
请帮助.
谢谢,
我正在尝试用2个标签实现滑动视图.为此,我使用带有2个片段的view pager.现在,问题在于,只要打开主活动(包含这两个选项卡),就会为两个片段调用onCreateView函数.请帮助我,因为我怎么能避免在使用第二个片段时调用onCreateView.
谢谢,Arpit