0

私はこのXMLを持っています:

<?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>

そしてこのように見えます:

ここに画像の説明を入力してください

問題は、TextViewが長すぎると、ボタンと重なることです。テキストが長いので、これらの要素を個別に使用したいと思います。コードに何を追加する必要がありますか?

ありがとうございました。

4

1 に答える 1

3

android:layout_toLeftOf="@+id/btnBrowser"テキストビューに次のコードを追加します。

于 2012-12-12T17:02:55.443 に答える