在它们之间的分隔TextViews [英] TextViews with dividers in between them
本文介绍了在它们之间的分隔TextViews的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想recrate在Android Studio中以下布局:
I am trying to recrate following layout in android studio:
由于我是preety新的android处的东西,我先用的LinearLayout tryed,并推断这thath大概不会有可能与它。现在我用的RelativeLayout想我已经创造了这个块颜色:
Because i am preety new at android stuff, i first tryed with LinearLayout, and figured thath this probably wont be possible with it. Now i am trying with RelativeLayout i already created this block with color:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="80dp"
android:background="@color/red_top">
</RelativeLayout>
现在我要问我怎么可以把它喜欢它是在相同的布局顶部图像1条和第2底部所示,我怎么可以把相同的边界?
Now i want to ask how can i divide it like it is shown at the image 1 bar at top and 2 at the bottom in the same layout, and how can i put same borders?
推荐答案
您可以通过下面的XML code做到这一点:
You can do this by using the following xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/custom_toast_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#CD96CD"
android:text="TEXT" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:background="#CD96CD"
android:text="TEXT" />
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#000000" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:background="#CD96CD"
android:text="TEXT" />
</LinearLayout>
</LinearLayout>
这篇关于在它们之间的分隔TextViews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文