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 ...
随机推荐
- 巧克力棒&&新年的巧克力棒
巧克力棒 题目描述 LYK 找到了一根巧克力棒,但是这根巧克力棒太长了,LYK 无法一口吞进去.具体地,这根巧克力棒长为 n,它想将这根巧克力棒折成 n 段长为 1 的巧克力棒,然后慢慢享用.它打算每 ...
- windows与linux下配置ant
转自:http://www.cnblogs.com/wuxinrui/archive/2012/01/06/2314392.html 1.下载:到ANT官方网站http://ant.apache.or ...
- v$open_cursor中的相同record
之前在查看v$open_cursor的时候,发现很多相同的record. 让我很疑惑, sid saddr sql_id 都相同,我就想 这不是一个cursor吗? 那为什么在open_cursor中 ...
- 解决ubuntu上opengl的问题
装完ubuntu之后,对于opengl的程序总是出现问题,先将解决方案列出如下: http://www.linuxforums.org/forum/ubuntu-linux/175490-graphi ...
- MVC.Net: jqueryval错误
当使用Mvc.net创建Create表单后,firebug Create页面会出现404 Not Found - http://192.168.3.95:7001/bundles/jqueryval& ...
- [ACM] POJ 3295 Tautology (构造)
Tautology Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9302 Accepted: 3549 Descrip ...
- double x = 10 ,y = 0;y = x % 2; 这个表达式正确吗?
The remainder function and % operator. 以下这段代码过不了编译的(gcc) #include <stdio.h> #include <fenv. ...
- luogu3155 [CQOI2009]叶子的染色
题目大意 给一棵m个结点的无根树,你可以选择一个度数大于1的结点作为根,然后给一些结点(根.内部结点和叶子均可)着以黑色或白色.你的着色方案应该保证根结点到每个叶子的简单路径上都至少包含一个有色结点( ...
- MySQL 基础 —— 字符串处理
1. 字符串截取 MySQL 字符串截取函数 常见的 MySQL 截取函数有: LEFT(), RIGHT(), SUBSTRING(), SUBSTRING_INDEX() SUBSTRING() ...
- Angularjs+Bootstrap实现分页指令
本插件的开发目的主要给前端同学使用,本人是专注于后台开发的,对css样式不熟悉,但逼于前端要求做一个共公组件方便日常开发,所以这个插件在样式上可能不适合大部分人,喜欢的拿走吧,不喜欢的也请别喷. 一 ...