我有我的布局xml文件:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/titlename" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/HostName" android:layout_weight="0" /> <TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0" /> </LinearLayout>
但我的要求是将我的输出结果如下:
| text1: text2 |
有人可以帮忙吗?
解决方法
使用以下代码
更新 :
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:weightSum="1" > <TextView android:id="@+id/titlename" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0.5" android:gravity="center" android:text="hi" /> <TextView android:id="@+id/name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0.5" android:gravity="center" android:text="2hi2" /> </LinearLayout>
原文地址:https://www.jb51.cc/android/316338.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。