
在线性布局中,我需要用一个透明的按钮覆盖一些文本视图,该按钮可填充整个布局大小(宽度/高度).我尝试过匹配父级布局属性,但这不起作用.谢谢您的帮助.
<linearLayout androID:ID="@+ID/layout1" androID:layout_wIDth="38dp" androID:layout_height="match_parent" androID:gravity="bottom" androID:orIEntation="vertical" > <TextVIEw androID:ID="@+ID/TVBlack" androID:layout_wIDth="28dp" androID:layout_height="wrap_content" androID:layout_gravity="center|bottom" androID:background="@color/black" androID:text="test" androID:textcolor="@color/white" /> <TextVIEw androID:ID="@+ID/TVWhite" androID:layout_wIDth="28dp" androID:layout_height="wrap_content" androID:layout_gravity="center|bottom" androID:text="test" androID:textcolor="@color/black" /> <button androID:ID="@+ID/button1" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:background="@null" androID:text="button" /> </linearLayout>解决方法:
线性布局无法实现您要执行的 *** 作,它不会使对象彼此重叠,只会按照声明的顺序并排放置对象.您需要使用FrameLayout来实现您所描述的内容,请参见此处的文档:
http://developer.android.com/reference/android/widget/FrameLayout.html
总结以上是内存溢出为你收集整理的带有按钮的android文本视图全部内容,希望文章能够帮你解决带有按钮的android文本视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)