PupopWindow弹出word文本域窗体控件,不能点击word文本域窗体控件内部的控件

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)二话不说直接上代码
只用到了三个地方,MainActivity 和 MainActivity的布局
,填充pupopwindow 的布局
MainActivity
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private RelativeLayout rl;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
rl = (RelativeLayout) findViewById(R.id.rl);
public void onClick(View view) {
switch (view.getId()) {
case R.id.tv:
ShowPopWindowShareToOther();
ImageView point_out_cha;
CheckBox user_protocol_cb;
TextView point_out_share_to_others;
PopupWindow share_to_others_tips_pop;//分享提醒
private void ShowPopWindowShareToOther() {
if (share_to_others_tips_pop == null) {
View view = LayoutInflater.from(this).inflate(R.layout.layout_share_to_others, null);
point_out_cha = (ImageView) view.findViewById(R.id.point_out_cha);//叉
user_protocol_cb = (CheckBox) view.findViewById(R.id.user_protocol_cb);//不再提示的选择框
point_out_share_to_others = (TextView) view.findViewById(R.id.point_out_share_to_others);//去分享
// 创建一个PopuWidow对象
share_to_others_tips_pop = new PopupWindow(view, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, true);
// 使其聚集 ,要想监听菜单里控件的事件就必须要调用此方法
share_to_others_tips_pop.setFocusable(true);
// 设置允许在外点击消失
share_to_others_tips_pop.setOutsideTouchable(false);
// 设置背景,这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景
share_to_others_tips_pop.setBackgroundDrawable(new BitmapDrawable());
//软键盘不会挡着popupwindow
share_to_others_tips_pop.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
//设置pop的动画
share_to_others_tips_pop.setAnimationStyle(R.style.showPopAnimation);// showPopAnimation在styles里
//设置菜单显示的位置
share_to_others_tips_pop.showAtLocation(rl, Gravity.BOTTOM, 0, 0);
point_out_share_to_others.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Toast.makeText(MainActivity.this, "点击了去分享", Toast.LENGTH_SHORT).show();
//前往去分享
share_to_others_tips_pop.dismiss();
point_out_cha.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
share_to_others_tips_pop.dismiss();
MainActivity的布局
&?xml version="1.0" encoding="utf-8"?&
&RelativeLayout 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:id="@+id/rl"
tools:context="com.example.popupwindow.MainActivity"&
android:id="@+id/tv"
android:onClick="onClick"
android:textSize="20sp"
android:padding="10dp"
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="按钮"/&
&/RelativeLayout&
最后一个就是填充PupopWindow的布局
&?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:orientation="vertical"&
&RelativeLayout
android:id="@+id/rl_point_out"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#3000"
android:onClick="onClick"&
&LinearLayout
android:background="#3000"
android:layout_width="268dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical"&
&RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp"&
&ImageView
android:id="@+id/point_out_cha"
android:layout_width="36dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_marginRight="12dp"
android:src="@mipmap/ic_launcher" /&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="您需要将这条圈动态分享到:微信、QQ才能领取该红包,请知晓!"
android:textSize="16sp" /&
&LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal"&
android:id="@+id/user_protocol_cb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick" /&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:text="不再提醒"
android:textSize="12sp" /&
&/LinearLayout&
&/RelativeLayout&
android:layout_width="match_parent"
android:layout_height="1dp" /&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal"&
android:id="@+id/point_out_share_to_others"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="去分享"
android:textSize="16sp" /&
&/LinearLayout&
&/LinearLayout&
&/RelativeLayout&
&/LinearLayout&
styles 的代码:
&style name="showPopAnimation" parent="android:Animation"&
&!--name为调用这个style动画的名字,自己设置的--&
&item name="android:windowEnterAnimation"&@anim/slide_in_bottom&/item&&!--- 进入动画--&
&item name="android:windowExitAnimation"&@anim/slide_out_bottom&/item&&!-- 退出动画--&
slide_in_bottom.xml:&set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"&
&translate
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="500"
android:fromXDelta="0%"
android:toXDelta="0%"
android:fromYDelta="100%"
android:toYDelta="0%"/&
slide_out_bottom.xml:&set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"&
&translate
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="500"
android:fromXDelta="0%"
android:toXDelta="0%"
android:fromYDelta="0%"
android:toYDelta="100%"/&他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)一开机出现了,可是一关闭这个就死机,好郁闷,这是什么程序?
这是一个系统自带的聊天软件~你可以在随系统启动的程序的列表中让这个程
序不启动。
这个就需要检查接口问题了
winpflet.exe 是病毒,它能更改 已编译的 HTML 帮助文件(.chm) 的打开方式为 winpflet.exe 。当你用杀毒软件杀毒时会查出该病毒...
珍藏软件软件序号
注★册★码★大★全
252525软件站
答: 设置成主页吧
答: 网络技术和应用的快速发展,也使得软件技术呈现出网络化、服务化与全球化的发展态势
答: 你要卓面连接的软件,在你的电脑系统盘就有了,你打开系统盘设置好就行了,你的系统在C盘的你就打开C盘找出来就行了,下面有图你细心看有助你的,你看图也不理解可以发个...
大家还关注
Copyright &
Corporation, All Rights Reserved
确定举报此问题
举报原因(必选):
广告或垃圾信息
激进时政或意识形态话题
不雅词句或人身攻击
侵犯他人隐私
其它违法和不良信息
报告,这不是个问题
报告原因(必选):
这不是个问题
这个问题分类似乎错了
这个不是我熟悉的地区
相关问答:123456789101112131415}

我要回帖

更多关于 vs2017窗体添加控件 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信