我有2 TextViews
,我需要水平并排,如类别+产品类别nummber类别。代码如下所示:第一个TextView重叠第二个,Android
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="15dp"
android:paddingBottom ="10dp"
android:background="@color/navigation_background_sub">
<TextView
android:id="@+id/category_name_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:textColor="@color/ebuy_color_navigation_name" />
<TextView
android:layout_toRightOf="@+id/category_name_second"
android:paddingLeft="7dp"
android:id="@+id/category_number_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:textColor="@color/ebuy_color_navigation_number" />
</RelativeLayout>
现在的问题是,一旦第一个TextView
文字长,左为第二空间是小和文本是两个或多个行显示。
我没有信誉张贴图片,所以我只是试图解释象下面这样:
如何,它是:
笔记本电脑(34)
计算机软件(1
4
)
它应该如何:
笔记本电脑(34)
计算机(14)
软件
对两个TextView都使用相同的ID。使他们独一无二,它应该工作 – hoomi 2014-08-30 16:15:58
他没有使用相同的ID。这甚至不可能 – eldjon 2014-08-30 16:16:30
你尝试过'layout_toEndOf'而不是'layout_toRightOf'吗? – mbmc 2014-08-30 16:16:58