最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android自定義View設(shè)定到FrameLayout布局中實(shí)現(xiàn)多組件顯示的方法 分享

 更新時(shí)間:2013年05月28日 10:16:47   作者:  
Android自定義View設(shè)定到FrameLayout布局中實(shí)現(xiàn)多組件顯示的方法 分享,需要的朋友可以參考一下

如果想在自定義的View上面顯示Button 等View組件需要完成如下任務(wù)

  1.在自定義View的類中覆蓋父類的構(gòu)造(注意是2個(gè)參數(shù)的)

復(fù)制代碼 代碼如下:

  public class MyView2 extends View{

  public MyView2(Context context,AttributeSet att)

  {super(context,att);

  }

  public void onDraw(Canvas c)

  { // 這里繪制你要的內(nèi)容

  }

  }


  2.定義布局文件
復(fù)制代碼 代碼如下:

< ?xml version="1.0" encoding="utf-8"?>

  < FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"

  android:orientation="vertical"

  android:layout_width="fill_parent"

  android:layout_height="fill_parent"

  >

  < com.lovose.MyView2

  android:id="@+id/View01"

  android:layout_width="fill_parent"

  android:layout_height="fill_parent"

  >

  < /com.lovose.MyView2>

  < AbsoluteLayout android:id="@+id/AbsoluteLayout01" android:layout_width="wrap_content" Android:layout_height="wrap_content">

  < Button android:text="Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="100dip" Android:layout_y="100dip">< /Button>

  < /AbsoluteLayout>

  < /FrameLayout>

  //哈哈,你可以任意定義UI的顯示了

相關(guān)文章

最新評論

浪卡子县| 鲁甸县| 新源县| 长沙县| 蒙自县| 车致| 嘉峪关市| 静海县| 游戏| 拜泉县| 中江县| 隆化县| 垫江县| 通道| 敦化市| 苗栗县| 十堰市| 彭山县| 三台县| 夏河县| 济源市| 建阳市| 益阳市| 醴陵市| 锡林浩特市| 涞水县| 寿光市| 区。| 鄄城县| 嘉黎县| 济源市| 山东省| 忻城县| 天祝| 安西县| 达州市| 元氏县| 元朗区| 黑山县| 卓尼县| 尉犁县|