android textview未并排对齐
我有4个文本视图,如-android textview未并排对齐,android,Android,我有4个文本视图,如- Departure Timinghello hello Time 45 sec 9 正如你所看到的- 1) 在离境问候中,“h”不从“D”以下开始。它在1个空格后开始 2) “9”与“45秒”不符 我如何做到这一点 借助于线性布局和权重完成这些操作 首先采用垂直线性布局,其中有两个水平线性布局,两个水平线性布局有两个重量相同的文本视图。尝试在文本视图中使用android:lay
Departure Timinghello
hello Time
45 sec
9
正如你所看到的-
1) 在离境问候中,“h”不从“D”以下开始。它在1个空格后开始
2) “9”与“45秒”不符
我如何做到这一点 借助于线性布局和权重完成这些操作
首先采用垂直线性布局,其中有两个水平线性布局,两个水平线性布局有两个重量相同的文本视图。尝试在文本视图中使用android:layout\u centerVertical=“true”
android:layout\u height=“fill\u parent”
试试这个:每行执行此操作Textview
<LinearLayout
android:id="@+id/setcancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="horizontal" >
<TextView
android:id="@+id/txt1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:textStyle="bold"
android:background="@drawable/top_color"
android:text="text"
/>
<TextView
android:id="@+id/setBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/top_color"
android:text="txt2"
android:textStyle="bold"
/>
</LinearLayout>
使用这种布局(对每行重复内线布局):
与布局无关。这是文本中的空格查看它自己请张贴您的代码和屏幕截图
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
>
<TextLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:weight="1"
android:gravity="left"
android:text="Departure"
/>
<TextLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:weight="1"
android:gravity="left"
android:text="TimingHello"
/>
</LinearLayout>
</LinearLayout>
TableLayout