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

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

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

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

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

復制代碼 代碼如下:

  public class MyView2 extends View{

  public MyView2(Context context,AttributeSet att)

  {super(context,att);

  }

  public void onDraw(Canvas c)

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

  }

  }


  2.定義布局文件
復制代碼 代碼如下:

< ?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的顯示了

相關文章

最新評論

谷城县| 津市市| 桃江县| 萨嘎县| 尚义县| 农安县| 德钦县| 和田县| 尖扎县| 鹤岗市| 通化县| 于田县| 新化县| 云梦县| 赤城县| 宁蒗| 苏尼特左旗| 新乐市| 马公市| 安宁市| 奉节县| 郑州市| 凤城市| 靖远县| 耿马| 桂林市| 武乡县| 綦江县| 德安县| 柯坪县| 康平县| 丹棱县| 二连浩特市| 东至县| 莫力| 定襄县| 烟台市| 深水埗区| 纳雍县| 扶余县| 双牌县|