SurfaceView在layout配置时注意事项
2012-10-18 10:56
113 查看
在android的layout布局xml配置自定义的SurfaceView,如下示例:
<com.babelstar.myviewer.VideoSurfaceView android:layout_width="fill_parent"
android:layout_height="288dp"
android:id="@+id/videoSurfaceView1"
/>
需要在SurfaceView实现以下构造函数,否则会出自定义SurfaceView不会被创建出来
public class VideoSurfaceView extends SurfaceView {
public VideoSurfaceView(Context context, AttributeSet attrs) {
// attrs为自定义属性,在xml配置,可以通过此参数来获取
super(context, attrs);
}
}
<com.babelstar.myviewer.VideoSurfaceView android:layout_width="fill_parent"
android:layout_height="288dp"
android:id="@+id/videoSurfaceView1"
/>
需要在SurfaceView实现以下构造函数,否则会出自定义SurfaceView不会被创建出来
public class VideoSurfaceView extends SurfaceView {
public VideoSurfaceView(Context context, AttributeSet attrs) {
// attrs为自定义属性,在xml配置,可以通过此参数来获取
super(context, attrs);
}
}
相关文章推荐
- springMVC配置文件部分简化的意义和注意事项
- Win10配置JDK变量注意事项
- 忆龙2009:Silverlight安装配置与注意事项
- svn仓库迁移及配置注意事项?
- svn仓库迁移及配置注意事项?
- .Net平台下MemcachedProviders配置记录和注意事项
- iOS10权限配置问题及上传Itunes审核注意事项
- spring集成mybatis配置说明及注意事项
- OpenCV 配置的注意事项
- 腾讯云主机ubuntu配置Tomcat及部署网站(小白鸡教程)(注意事项)
- PHP中级篇 Apache配置httpd-vhosts虚拟主机总结及注意事项[OK]
- Mac OS X Yosemite 10.10 配置 Apache+PHP 教程注意事项
- VS2013+QT5.4.1环境配置和注意事项
- 异步FIFO的配置与使用注意事项
- STM32f030 boot iap升级时keil配置注意事项
- 从Oracle RAC角度看跨数据中心的存储双活配置注意事项
- AutoLayout的一些注意事项
- ssh免密码登陆配置及注意事项
- Windows平台下MySQL安装与配置方法与注意事项
- phpstorm 配置 xdebug注意事项