0
1 텍스트 뷰와 2 개 버튼을 독립적으로 설정합니다나는이 XML 가지고 RelativeLayout의
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/upperBar"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtForum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="25dp"
android:textColor="#255094"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_alignParentLeft="true"
android:maxLines="2"
android:scrollbars="vertical"
>
</TextView>
<ImageButton
android:id="@+id/btnBrowser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_alignParentRight="true"
android:src="@drawable/icon_browser"
android:contentDescription="Open Browser"
>
</ImageButton>
<Button
android:id="@+id/btnNewThread"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NewThread"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_toLeftOf="@+id/btnBrowser">
</Button>
</RelativeLayout>
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#00000000"
android:padding="10dp"
android:layout_below="@+id/upperBar">
</ListView>
</LinearLayout>
을 그리고 다음과 같습니다
문제는 텍스트 뷰가 너무 긴 경우,이다 , 버튼들과 겹쳐집니다. 텍스트가 길다는 점을 독자적으로 생각하고 싶습니다. 내 코드에 무엇을 추가해야합니까?
감사합니다.
여전히 버튼과 겹칩니다. 하지만 추가 할 경우 : android : layout_toLeftOf = "@ + id/btnNewThread"작동합니다. 고맙습니다. – Davis
네 말이 맞아. 잘못된 id를 복사했습니다. @ + id/btnNewThread를 사용해야합니다. –