java – 使用MATCH_PARENT的RelativeLayout不起作用
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java – 使用MATCH_PARENT的RelativeLayout不起作用,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2168字,纯文字阅读大概需要4分钟。
内容图文
![java – 使用MATCH_PARENT的RelativeLayout不起作用](/upload/InfoBanner/zyjiaocheng/808/85abf5e613cc478294176d01950536ed.jpg)
这就是我想要实现的目标:
我在桌上有很多表行.每行应该有两个文本视图,产品标题和副标题相互叠加(副标题尚未实现).应该左对齐.在右边,我想要一个微调器来选择数量.
文本来自数据库,当然有不同的长度.
这是我到目前为止所提出的:
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/barmenu"
android:background="#99ffff"
android:scrollbars="vertical">
<TableRow
android:layout_height="wrap_content"
android:background="#ffff99"
android:layout_width="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:background="#0000ff">
<TextView
android:id="@+id/productTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#88ffff"
android:ellipsize="end"
android:padding="2dp"
android:singleLine="true"
android:text="Product name"
android:textColor="#000000"
android:gravity="left"
android:textSize="13sp"
android:textStyle="bold" />
<Spinner
android:gravity="right"
android:layout_height="40dp"
android:layout_toRightOf="@id/productTitle"
android:width="100dp"
android:layout_width="wrap_content" />
</RelativeLayout>
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:background="#ffff99"
android:layout_width="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:background="#0000ff">
<TextView
android:id="@+id/productTitle2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#88ffff"
android:ellipsize="end"
android:padding="2dp"
android:singleLine="true"
android:text="Some long long long long name"
android:textColor="#000000"
android:gravity="left"
android:textSize="13sp"
android:textStyle="bold" />
<Spinner
android:gravity="right"
android:layout_height="40dp"
android:layout_toRightOf="@id/productTitle2"
android:width="100dp"
android:layout_width="wrap_content" />
</RelativeLayout>
</TableRow>
</TableLayout>
</ScrollView>
Screendump:
第一个问题是RelativeLayout没有填写表格行的宽度.第二个问题:纺纱厂没有正确对齐.
我错过了什么?
最好的祝福
艾伦
解决方法:
android:fillViewport=”true”
将此行添加到您的ScollView属性中,您就完成了:)
内容总结
以上是互联网集市为您收集整理的java – 使用MATCH_PARENT的RelativeLayout不起作用全部内容,希望文章能够帮你解决java – 使用MATCH_PARENT的RelativeLayout不起作用所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。