posts - 93,  comments - 2,  trackbacks - 0
1.建立FrameLayout,因为该布局方式只显示下层内容,如:
 1 <FrameLayout
 2     xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="fill_parent">
 5     <LinearLayout
 6         android:layout_width="fill_parent"
 7         android:layout_height="fill_parent"
 8         android:orientation="vertical" 
 9         android:id="@+id/main"
10         android:background="@color/white"
11         >
12         <LinearLayout 
13             android:layout_width="fill_parent"
14             android:layout_height="wrap_content"
15             >
16             <GridView
17                 android:id="@+id/gridview_send"
18                 android:layout_width="fill_parent"
19                 android:layout_height="fill_parent"
20                 android:layout_marginLeft="20dp"
21                 android:layout_marginTop="40dp"
22                 android:listSelector="@color/bule_overlay"
23                 android:numColumns="4" >
24                    </GridView>
25         </LinearLayout>
26         <ImageView 
27             android:layout_width="fill_parent"
28             android:layout_height="wrap_content"
29             android:src="@drawable/service_public_diver"
30             android:layout_marginLeft="20dp"
31             android:layout_marginRight="20dp"
32             android:layout_marginTop="40px"
33             /> 
34          <EditText
35             android:id="@+id/issueContent"
36             android:layout_width="fill_parent"
37             android:layout_height="wrap_content"
38             android:minLines="4"
39             android:gravity="top"
40             android:layout_marginLeft="20dp"
41             android:layout_marginRight="20dp"
42             android:layout_marginTop="30px"
43             android:textColor="#e3e3e3"
44             android:hint="请输入内容"
45             android:background="@null"
46             android:textSize="46px"/>
47          <ImageView 
48             android:layout_width="fill_parent"
49             android:layout_height="wrap_content"
50             android:src="@drawable/service_public_diver"
51             android:layout_marginLeft="20dp"
52             android:layout_marginRight="20dp"
53             android:layout_marginTop="40dp"
54             /> 
55     </LinearLayout>
56     <LinearLayout 
57         android:id="@+id/layerMask"
58         android:layout_width="fill_parent"
59         android:layout_height="fill_parent"
60         android:orientation="vertical" 
61         android:background="@drawable/common_title_back"
62         android:visibility="gone">
63      </LinearLayout>
64 </FrameLayout>

2.在layerMasK中添加view内容
    private LinearLayout layerMask;//遮罩层
  layerMask = (LinearLayout)contentView.findViewById(R.id.layerMask);
    addInnerLayout(R.layout.fragment_takephotoathand_layer,layerMask);
    //设置点击不退出遮罩层
  layerMask.setOnTouchListener(new OnTouchListener(){  
            @Override  
            public boolean onTouch(View v, MotionEvent event) {  
                return true;  
            }  
        });

    private void addInnerLayout(int layoutResID,LinearLayout view){
LayoutInflater inflater = (LayoutInflater) ((Activity) mContext).getLayoutInflater();
View CurView = inflater.inflate(layoutResID, null);
LinearLayout.LayoutParams lineparam = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.MATCH_PARENT);
view.addView(CurView,lineparam);
}
3.控制显示
    layerMask.setVisibility(View.VISIBLE);
posted on 2014-09-11 08:13 Terry Zou 阅读(1233) 评论(0)  编辑  收藏 所属分类: Android

只有注册用户登录后才能发表评论。


网站导航:
 
<2014年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用链接

留言簿(2)

随笔分类

随笔档案

文章分类

文章档案

相册

收藏夹

Java

搜索

  •  

最新随笔

最新评论

阅读排行榜

评论排行榜