Activity遮罩效果的实现

本文介绍了在Android中实现遮罩效果的几种方法,包括在FrameLayout中添加覆盖层、使用Dialog以及通过PopupWindow来创建遮罩。还特别提到,当底层是ScrollView时,使用TextView或PopupWindow可能会导致滚动问题,而Dialog可以避免这个问题。
摘要由CSDN通过智能技术生成

android 中遮罩效果有多种实现方法:


1、framelayout中添加一层,覆盖在所有层上

<?xml version="1.0" encoding="utf-8"?>  
		<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"  
		    android:id="@+id/layout"  
		    android:layout_width="fill_parent"  
		    android:layout_height="fill_parent"   
		    android:background="#fff">  
		    <RelativeLayout  
		        android:layout_width="fill_parent"  
		        android:layout_height="wrap_content"  
		        android:layout_gravity="bottom"  
		        android:background="#86222222"  
		        android:orientation="horizontal" >  
		  
		        <TextView  
		            android:id="@+id/titleTextView"  
		            android:layout_width="wrap_content"  
		            android:layout_height="wrap_content"  
		            android:text="遮罩效果"  
		            android:textColor="#ff0000" />  
		  
		        <Button  
		            android:id="@+id/unfoldButton"  
		            android:layout_width="wrap_content"  
		            android:layout_height="wrap_content"  
		            android:layout_alignParentRight="true"  
		            android:text="显示遮罩" />  
		    </RelativeLayout>  
		  
		</FrameLayout> 



public class ShadeActivity extends Activity {  
	    // 设置是否展开  
	    private boolean isFolded = true;  
	    // 设置控件  
	    private FrameLayout layout = null;  
	    private Button u
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值