我正在开发一款应用程序,在其中我希望一个线性布局显示在键盘的顶部。当用户关闭键盘时,该线性布局也应该消失。我希望它像这样:
所需布局:
这条消息来自于 iOS 手机,但我们能在 Android 上实现这个功能吗?
所需布局:
<?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" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<RelativeLayout
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/iv_Img1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/iv_Img2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="fitXY" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:id="@+id/iv_Edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:padding="5dp"
android:scaleType="center"
android:src="@drawable/cam" />
</RelativeLayout>
<LinearLayout
android:id="@+id/llEditOptions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_weight="0"
android:visibility="gone" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<ImageView
android:id="@+id/iv_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="50dp"
android:layout_toLeftOf="@+id/iv_font"
android:scaleType="center"
android:src="@drawable/save_1" />
<ImageView
android:id="@+id/iv_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:scaleType="center"
android:src="@drawable/cam" />
<ImageView
android:id="@+id/iv_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="50dp"
android:layout_toRightOf="@+id/iv_font"
android:scaleType="center"
android:src="@drawable/share_1" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/llCamOptions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_weight="0" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/iv_Save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="50dp"
android:layout_toLeftOf="@+id/iv_Camera"
android:scaleType="center"
android:src="@drawable/save_1" />
<ImageView
android:id="@+id/iv_Camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:scaleType="center"
android:src="@drawable/cam" />
<ImageView
android:id="@+id/iv_Share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="50dp"
android:layout_toRightOf="@+id/iv_Camera"
android:scaleType="center"
android:src="@drawable/share_1" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
这条消息来自于 iOS 手机,但我们能在 Android 上实现这个功能吗?