我想用自定义高度设置glsurfacevIEw的高度.
我希望宽度与高度相同.
使用android:layout_wIDth =“fill_parent”.
我怎么做宽度=高度= wIDth_of_the_screen?
非常感谢
解决方法:
您需要覆盖onMeasure并将setMeasuredDimension的两个参数设置为接收的宽度,如下所示:
class touchSurfaceVIEw extends GLSurfaceVIEw {@OverrIDeprotected voID onMeasure(int wIDthMeasureSpec, int heightmeasureSpec) { int wIDth = VIEw.MeasureSpec.getSize(wIDthMeasureSpec); this.setMeasuredDimension(wIDth, wIDth);}...
布局如下:
...<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:orIEntation="horizontal" androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:layout_gravity="top" > <se.company.test.touchSurfaceVIEw androID:ID="@+ID/glSurface" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" /></linearLayout>...
总结 以上是内存溢出为你收集整理的glsurfaceview的Android setHeight全部内容,希望文章能够帮你解决glsurfaceview的Android setHeight所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)