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

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          Java

          搜索

          •  

          最新隨筆

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 连城县| 遂昌县| 鄯善县| 华亭县| 潼关县| 洛浦县| 宝坻区| 五家渠市| 克东县| 睢宁县| 无棣县| 临邑县| 东兴市| 遂川县| 长葛市| 湘乡市| 长垣县| 长宁区| 沧源| 民乐县| 黎平县| 蓬莱市| 分宜县| 衢州市| 正定县| 曲靖市| 从江县| 彭山县| 姜堰市| 南江县| 葵青区| 咸丰县| 琼结县| 海盐县| 登封市| 高密市| 隆回县| 松滋市| 陆丰市| 龙山县| 贵溪市|