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 閱讀(1244) 評論(0)  編輯  收藏 所屬分類: Android
          <2014年9月>
          31123456
          78910111213
          14151617181920
          21222324252627
          2829301234
          567891011

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          Java

          搜索

          •  

          最新隨筆

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 光泽县| 武隆县| 苏尼特左旗| 宜阳县| 雷州市| 无棣县| 南丰县| 黄大仙区| 阳春市| 荆门市| 香格里拉县| 淄博市| 南和县| 蚌埠市| 田阳县| 二连浩特市| 宜昌市| 马鞍山市| 商水县| 博白县| 炉霍县| 工布江达县| 甘洛县| 平果县| 平潭县| 凉山| 色达县| 土默特右旗| 安阳县| 翁牛特旗| 台东市| 辉县市| 和平区| 米易县| 淮北市| 平昌县| 延吉市| 东兴市| 甘孜县| 安多县| 阜新|