如何在Android Java中通过软键盘(如WhatsApp附件)覆盖框架布局
我在我的项目中使用了库来创建像WhatsApp一样的附件对话框,但当我打开软键盘&然后打开附件对话框时,我想在键盘上重叠我的对话框 我在聊天室_activity.xml中添加的代码如何在Android Java中通过软键盘(如WhatsApp附件)覆盖框架布局,java,android,Java,Android,我在我的项目中使用了库来创建像WhatsApp一样的附件对话框,但当我打开软键盘&然后打开附件对话框时,我想在键盘上重叠我的对话框 我在聊天室_activity.xml中添加的代码 <FrameLayout android:layout_above="@+id/textContainer" android:layout_width="match_parent" android:layout_alignP
<FrameLayout
android:layout_above="@+id/textContainer"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_marginBottom="60dp"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_height="wrap_content">
<io.codetail.widget.RevealFrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/attachments_popup"/>
</io.codetail.widget.RevealFrameLayout>
</FrameLayout>
任何帮助都将不胜感激
提前谢谢
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="@drawable/attachments_bg"
android:elevation="1dp"
android:layout_marginTop="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="2dp"
android:padding="8dp"
android:id="@+id/reveal_window_sheet"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".Activities.ChatRoom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="14dp"
android:orientation="horizontal"
android:baselineAligned="false"
tools:ignore="UselessParent">
<LinearLayout
android:id="@+id/layoutGallery"
android:layout_width="0dp"
android:onClick="openDocuments"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:src="@drawable/ic_documents"
android:padding="14dp"
android:background="@drawable/document_bg"
app:tint="@android:color/white"
android:contentDescription="@string/app_name" />
<TextView
android:id="@+id/tvGallery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/document"
android:layout_marginTop="10dp"
android:textSize="16sp"
android:textColor="#4d4747"/>
</LinearLayout>
<LinearLayout
android:id="@+id/layoutPhoto"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="openCamera"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:src="@drawable/ic_camera"
android:padding="14dp"
android:background="@drawable/camera_bg"
app:tint="@color/white"
android:contentDescription="@string/app_name" />
<TextView
android:id="@+id/tvPhoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/camera"
android:layout_marginTop="10dp"
android:textSize="16sp"
android:textColor="#4d4747"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="14dp"
android:orientation="horizontal"
android:baselineAligned="false"
tools:ignore="UselessParent">
<LinearLayout
android:id="@+id/layoutVideo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:onClick="openGallery"
android:layout_weight="1"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:background="@drawable/gallery"
android:contentDescription="@string/app_name"
android:padding="14dp"
android:src="@drawable/ic_gallery"
app:tint="@color/white" />
<TextView
android:id="@+id/tvVideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="@string/gallery"
android:textColor="#4d4747"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:onClick="openAudio"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:src="@drawable/ic_audio"
app:tint="@color/white"
android:background="@drawable/audio"
android:padding="14dp"
android:contentDescription="@string/app_name" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/audio"
android:layout_marginTop="10dp"
android:textSize="16sp"
android:textColor="#4d4747"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
attachments.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cx = (int) (attachments.getX() + (attachments.getWidth()/2));
cy = (int) (attachments.getY()) + reveal_window_sheet.getHeight();
radius = Math.max(reveal_window_sheet.getWidth(), reveal_window_sheet.getHeight());
if (hidden) {
Animator anim = android.view.ViewAnimationUtils.createCircularReveal(reveal_window_sheet, cx, cy, 0, radius);
reveal_window_sheet.setVisibility(View.VISIBLE);
anim.start();
hidden = false;
} else {
Animator anim = android.view.ViewAnimationUtils.createCircularReveal(reveal_window_sheet, cx, cy, radius, 0);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
reveal_window_sheet.setVisibility(View.INVISIBLE);
hidden = true;
}
});
anim.start();
}
}
});