我想在屏幕的宽度上间隔出 3 个 TextView,第一个 TextView 接触左边距,第三个 TextView 接触右边距。
目前我能够实现以下目标:
|文本[空格]文本[空格]文本[空格]|
和
|[空格]文字[空格]文字[空格]文字|
和
|[空格/2]文本[空格]文本[空格]文本[空格/2]|
通过在水平 ListView 中分别设置左、右和中心重力。
我想实现:
|文本[空格]文本[空格]文本|
但我似乎无法理解。这是我的 XML:
<LinearLayout
android:id="@+id/graph_xaxis_labels"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/linegraph_fragment"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:orientation="horizontal">
<TextView
android:id="@+id/textview_xaxis_0"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="8sp"
android:text="02/12"
/>
<TextView
android:id="@+id/textview_xaxis_1"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="8sp"
android:text="02/13"
/>
<TextView
android:id="@+id/textview_xaxis_2"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="8sp"
android:text="02/14"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。
PS:我知道硬编码 TextView 文本是不好的。那只是暂时的。