저는 다음과 같이하려고합니다 : http://img202.imageshack.us/img202/552/layoutoy.png. 이 목록 항목으로 (기술적으로 ExpandableListView 그룹보기) 사용하고 있습니다.버튼을 TextView와 겹치지 않고 오른쪽으로 정렬하는 방법은 무엇입니까?
다음은 XML 파일입니다 :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight">
<TextView
android:id="@+id/list_item_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end" />
<Button
android:id="@+id/list_item_button"
android:text="Click me!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/list_item_text" />
</RelativeLayout>
하지만이 작동하지 않습니다. 버튼은 내용을 감싸지 않고 모든 사용 가능한 가로 공간을 사용합니다. TextView 은으로 내용을 래핑하지만, 내가 원하는 것은 버튼과 겹칠 때 잘리는 것입니다.
즉, textviews의 텍스트 양에 관계없이 모든 버튼이 동일한 너비에 있어야합니다. 이 모든 가능한에서인가?
트릭, 건배! – benvd
+1. 좋은 생각! – Tiago