Android LinearLayout整个布局设置不可点击
1,activity的xml布局(布局中有个Button按钮,点击按钮弹出一个popupwindow )
<?xml version="1.0" encoding="utf-8"?>
<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:background="@drawable/ic_launcher_background"
tools:context=".MainActivity">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:onClick="click"
android:textSize="30sp"
android:text="弹窗Popupwindow"/>
</LinearLayout>
2,上图中有白色背景的popupwindow 的xml布局:
<?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:gravity="center"
android:id="@+id/ll_popup">
<LinearLayout
android:id="@+id/ll_popup_content"
android:layout_width="600dp"
android:layout_height="400dp"
android:gravity="center"
android:background="@android:color/white">
<ImageView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="250dp"
android:padding="10dp"
android:src="@drawable/fengjing"
android:layout_marginRight="20dp"/>
<ImageView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="250dp"
android:padding="10dp"
android:src="@drawable/small"/>
</LinearLayout>
</LinearLayout>
3,MainActivity的代码实现:
public class MainActivity extends AppCompatActivity {
private View pop;
private LinearLayout ll_popup,ll_popup_content;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pop = View.inflate(this, R.layout.popupwindow_test, null);
ll_popup = pop.findViewById(R.id.ll_popup);
ll_popup_content = pop.findViewById(R.id.ll_popup_content);
ll_popup_content.setOnClickListener(null);//Linearloyout就不可点击了
}
public void click(View view) {
final PopupWindow popupWindow = new PopupWindow(pop, MATCH_PARENT, MATCH_PARENT);
ll_popup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popupWindow.dismiss();
}
});
popupWindow.showAtLocation(getWindow().getDecorView(), Gravity.TOP,0,0);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
//完全沉浸式
super.onWindowFocusChanged(hasFocus);
if (hasFocus && Build.VERSION.SDK_INT >= 19) {
View decorView = getWindow().getDecorView(http://www.my516.com);
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
}
---------------------
Android LinearLayout整个布局设置不可点击的更多相关文章
- Android LinearLayout线性布局详解
为了更好地管理Android应用的用户界面里的各组件,Android提供了布局管理器.通过使用布局管理器,Android应用图形用户界面具有良好的平台无关性.推荐使用布局管理器来管理组件的分布.大小, ...
- Android linearlayout常用布局
用linearlayout完成这样的布局效果,这样的布局还是比较常用的,具体的xml代码如下: <LinearLayout xmlns:android="http://schemas. ...
- Android LinearLayout线性布局
LinearLayout是线性布局控件:要么横向排布,要么竖向排布 决定性属性:必须有的! android:orientation:vertical (垂直方向) .horizontal(水平方向) ...
- Android 手机卫士--实现设置界面的一个条目布局结构
本文地址:http://www.cnblogs.com/wuyudong/p/5908986.html,转载请注明源地址. 本文以及后续文章,将一步步完善功能列表: 要点击九宫格中的条目,需要注册点击 ...
- 无废话Android之常见adb指令、电话拨号器、点击事件的4种写法、短信发送器、Android 中各种布局(1)
1.Android是什么 手机设备的软件栈,包括一个完整的操作系统.中间件.关键的应用程序,底层是linux内核,安全管理.内存管理.进程管理.电源管理.硬件驱动 2.Dalvik VM 和 JVM ...
- 关于android LinearLayout的比例布局(转载)
关于android LinearLayout的比例布局,主要有以下三个属性需要设置: 1,android:layout_width,android:layout_height,android:layo ...
- 个人经验 - Android的RelativeLayout布局的layout_height属性设置为wrap_content时的坑
Android的RelativeLayout布局的layout_height属性设置为wrap_content时的坑: 此坑出现的条件: 1.RelativeLayout布局的layout_heigh ...
- android LinearLayout和RelativeLayout实现精确布局
先明确几个概念的区别: padding margin:都是边距的含义,关键问题得明白是什么相对什么的边距padding:是控件的内容相对控件的边缘的边距. margin :是控件边缘相对父空间的边距 ...
- Android布局管理详解(1)—— LinearLayout 线性布局
Android的布局方式共有6种,分别是LinearLayout(线性布局).TableLayout(表格布局).FrameLayout(帧布局).RelativeLayout(相对布局).GridL ...
随机推荐
- Hello, HTML5!
一个典型的HTML5文档的基础结构如下: <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”utf ...
- 高仿京东APP首页“京东快报”自己主动向上滚动的广告条
转载请标明出处: http://blog.csdn.net/hai_qing_xu_kong/article/details/51013562 本文出自:[顾林海的博客] 前言 上次在京东APP上买东 ...
- 飘逸的python - 实现glob style pattern
一说起通配符,大家非常快就会想起*和? 号,有了通配符,使得表达能力大大增强,非常多linux命令都支持这个东西,事实上就是glob style pattern. 就连redis的keys命令都支持g ...
- PHP array_count_values()
定义和用法 array_count_values() 函数用于统计数组中所有值出现的次数. 本函数返回一个数组,其元素的键(索引)是原数组的值,元素的值是该值在原数组中出现的次数. 语法 array_ ...
- 在Ubuntu 14.04 上安装 FTP 服务
1. sudo apt-get update 2. sudo apt-get install vsftpd 3. adduser sammy Assign a password when prompt ...
- VMware镜像文件下载
VMware镜像文件下载 http://blog.sina.com.cn/s/blog_517c21c00102x5ja.html 貌似Centos 6不能下载啊: 其他的没有测试:
- Android 绘制圆形图片
经常在项目中,会遇到使用圆形头像. 然而图片往往不是圆形的,我们须要对图片进行处理.以达到圆形图片的效果.这里.我总结了一下经常使用的android圆形图片的绘制的方法. 主要有以下几种方式:1.画布 ...
- dlk 模板
struct DLX { int n , m,size; int U[N],D[N],R[N],L[N],row[N],col[N]; int ans[N],S[N]; int ansd; void ...
- iOS手势识别
一.手势识别与触摸事件 1.如果想监听一个view上面的触摸事件,可选的做法是: (1)自定义一个view (2)实现view的touches方法,在方法内部实现具体处理代码 2.通过touches方 ...
- 8.19noip模拟题
2017 8.19 NOIP模拟赛 by coolyangzc 共3道题目,时间3小时 题目名 高级打字机 不等数列 经营与开发 源文件 type.cpp/c/pas num.cpp/c/pas ...