绵贯真弓,雷顿教授与恶魔之箱,花都十二钗
如果想在自定义的view上面显示button 等view组件需要完成如下任务
1.在自定义view的类中覆盖父类的构造(注意是2个参数的)
public myview2(context context,attributeset att)
{super(context,att);
}
public void ondraw(canvas c)
{ // 这里绘制你要的内容
}
}
< 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的显示了
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Android apk 项目一键打包并上传到蒲公英的实现方法
Android 自定义LineLayout实现满屏任意拖动功能的示例代码
android 限制某个操作每天只能操作指定的次数(示例代码详解)
Android 集成 google 登录并获取性别等隐私信息的实现代码
网友评论