[英]Android Studio - Relative Layout on top of buttons have transparent background
I am trying to create a RelativeLayout
on the top of another containing buttons
in order to hide the ones below. 我试图在另一个包含
buttons
的顶部创建一个RelativeLayout
,以隐藏下面的buttons
。
I have set a black background to the top RelativeLayout
however, the layout is till transparent showing the objects underneath. 我在顶部的
RelativeLayout
设置了黑色背景,但是该布局一直透明,显示了下面的对象。 Also The buttons
behind the top relative layout are still clickable. 同样,顶部相对布局后面的
buttons
仍然可以单击。
My question is how can I use a RelativeLayout
in order to hide another one containing object underneath? 我的问题是如何使用
RelativeLayout
来隐藏下面的另一个包含对象的对象? The top relative layout should be NOT transparent and the buttons
underneath not clickable. 顶部相对布局应不透明的,并且
buttons
的下面不能点击。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:visibility="gone"
android:id="@+id/buttons"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Your buttons go here -->
</RelativeLayout>
<RelativeLayout
android:id="@+id/prompt"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- your prompt -->
</RelativeLayout>
</FrameLayout>
and when you're done with your prompt relative layout, then from your activity say something like this: 并且当您完成提示的相对布局后,请从您的活动中说出以下内容:
View prompt = findeViewById(R.id.prompt);
prompt.setVisibility(View.GONE);
and then visible your button layout 然后可见您的按钮布局
View buttonLayout = findeViewById(R.id.buttons);
buttonLayout.setVisibility(View.VISIBLE);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.