【发布时间】:2017-05-24 02:03:29
【问题描述】:
我有以下 list_item.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/points_a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:orientation="horizontal">
<TextView
android:id="@+id/score_a"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:text="@string/zero"
android:textSize="20sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@android:color/darker_gray"/>
<LinearLayout
android:id="@+id/points_b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:padding="10dp">
<TextView
android:id="@+id/score_b"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:text="@string/zero"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
这导致了这个视图:
但我想要类似的东西:
所以只是垂直边框顶部的文本,其中包含一些文本。
我找到了水平线的解决方案,但我无法采用它: Android : horizontal line with text in middle
【问题讨论】:
-
您可能需要制作一个由方框和垂直线组成的九个补丁可绘制对象。
标签: android