我有两个TextView的。当第一个太长时,第二个消失。我已经尝试RelativeLayout与android:layout_alignParentRight="true"
,但它并不真的为我工作。当第一个TextView太长,第二个disapper
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_margin"
android:text="@string/movie_title"
android:textColor="#FFFFFF"
android:textSize="22sp" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@+id/textView1"
android:layout_marginLeft="@dimen/list_margin"
android:text="@string/new_sounds"
android:textColor="#8C1717"
android:textSize="13sp"
android:visibility="1"/>
</RelativeLayout>
这将是单行ListView中,其中第一TextView的是电影的标题,有时会出现另一个文本可见的布局。但是,正如我所说,当电影标题很长时,屏幕上看不到textView2
。我该怎么做才能让它在第一个结束的地方(例如它结束于第二行,然后是textView2
)
变化的android:layout_width = “WRAP_CONTENT” 到match_parent(均为textViews),然后加入Android:layout_alignParentLeft = “true” 以textView1。这应该做的伎俩。如果它起作用,就写。 –
不是。总而言之,我用'android:layout_weight'制作了LinearLayout。这不是我想要的,但它工作正常。 – Roval