TableLayout有边框吗?
我正在开发一个 droid 应用程序,我正在使用 TableLayout,但无法让它看起来像我想要的那样。我想要两列,一列用于文本,一列用于货币值,但我无法将它们居中(在表格中)并彼此相邻显示。
我试图让它看起来像这样...
http://s2.postimage.org /8wpons46m/whmcs.png
但由于我实际上看不到边框,所以我不知道如何修复它。这就是它目前的样子...
这是我的表的 XML 布局
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0"
android:background="@drawable/round_table">
<TableRow>
<TextView
android:layout_column="1"
android:text="Today's Income:"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:layout_width="0dip"
android:padding="3dip" />
<TextView
android:text="$0.00 USD"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:padding="3dip" />
</TableRow>
<View
android:layout_height="2dip"
android:background="#000000" />
<TableRow>
<TextView
android:layout_column="1"
android:text="Monthly Income:"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:padding="3dip" />
<TextView
android:text="$0.00 USD"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:padding="3dip" />
</TableRow>
<View
android:layout_height="2dip"
android:background="#000000" />
<TableRow>
<TextView
android:layout_column="1"
android:text="Annual Income:"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:padding="3dip" />
<TextView
android:text="$0.00 USD"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:padding="3dip" />
</TableRow>
</TableLayout>
I am working on a droid application, and I am using a TableLayout but cannot get it to look how I want. I want to have 2 columns, one for the text and one for the monetary value, but I cannot get them centered (in the table) and showing up next to each other.
I am trying to get it to look like this...
http://s2.postimage.org/8wpons46m/whmcs.png
but since I cannot actually see the borders, I cannot figure out how to fix it. This is what it currently looks like...
Here is the XML layout for my Table
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0"
android:background="@drawable/round_table">
<TableRow>
<TextView
android:layout_column="1"
android:text="Today's Income:"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:layout_width="0dip"
android:padding="3dip" />
<TextView
android:text="$0.00 USD"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:padding="3dip" />
</TableRow>
<View
android:layout_height="2dip"
android:background="#000000" />
<TableRow>
<TextView
android:layout_column="1"
android:text="Monthly Income:"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:padding="3dip" />
<TextView
android:text="$0.00 USD"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:padding="3dip" />
</TableRow>
<View
android:layout_height="2dip"
android:background="#000000" />
<TableRow>
<TextView
android:layout_column="1"
android:text="Annual Income:"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:padding="3dip" />
<TextView
android:text="$0.00 USD"
android:typeface="sans"
android:textSize="10sp"
android:textColor="#000000"
android:gravity="center"
android:padding="3dip" />
</TableRow>
</TableLayout>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用layout_weight,下面代码行中的某些内容应该适合您的目的。
use layout_weight, something on the lines of below code should work for your purpose.