0

私は Android アプリケーションを設計していますが、行き詰まっています。多くのことを試しましたが、これまでのところ何も役に立ちませんでした。複数の TextView とボタンを持つアクティビティがあります。これらのテキストビューの 1 つはアドレスを保持しますが、複数行にすることができます。そのため、1行になることもあれば、最大4行になることもあります。下にボタンを配置したいと思います。テキストビューに1行しかない場合は問題ありませんが、それ以上の場合はテキストがボタンの上に表示されます。私のXMLファイルのビューは次のとおりです。

<TextView
   android:id="@+id/locatie"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:textAppearance="?android:attr/textAppearanceMedium"/>
<Button
   android:id="@+id/button1"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_alignParentLeft="true"
   android:layout_alignParentRight="true"
   android:layout_below="@+id/locatie"
   android:text="@string/mapknop" />

テキストビューで最小行数や最大行数など、多くのことを試しましたが、何も機能していません。誰にも解決策がありますか?ありがとう

編集: ここに私の完全な XML ファイルがあります

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/evenement"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="5dp"
        android:contentDescription="@string/affiche"
        android:onClick="showImage" />

    <TextView
        android:id="@+id/datum"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/imageView1"
        android:layout_marginTop="19dp"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/uren"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/datum"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/DETAILS"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/uren"
        android:layout_marginTop="24dp"
        android:text="@string/details"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/DETAILS"
        android:text="@string/vvk"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/textView1"
        android:text="@string/kassa"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/textView2"
        android:text="@string/locatie"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/vvk"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textView2"
        android:layout_marginLeft="18dp"
        android:layout_toRightOf="@+id/textView3"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/kassa"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textView3"
        android:layout_alignLeft="@+id/vvk"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <!--  PROBLEM OCCURS FROM HERE -->
    <TextView
        android:id="@+id/locatie"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/textView3"
        android:layout_alignBottom="@+id/textView3"
        android:layout_alignLeft="@+id/kassa"
        android:textAppearance="?android:attr/textAppearanceMedium"/>

      <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/locatie"
        android:text="@string/mapknop" />

      <!--  UNTIL HERE -->

    <TextView
        android:id="@+id/omschrijving"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/textView4" />

    <TextView
        android:id="@+id/TextView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/omschrijving"
        android:layout_marginTop="49dp"
        android:layout_alignLeft="@+id/lineup"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textStyle="bold" 
        android:text="@string/lineup"/>

    <TextView
        android:id="@+id/lineup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/TextView5" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/button1"
        android:text="@string/omschrijving"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textStyle="bold" />



</RelativeLayout>

編集:これは1行と2行のスクリーンショットです

http://i.imgur.com/uChHNmA.jpg?1 http://i.imgur.com/5w0mjoh.jpg

4

1 に答える 1

0

より良い TextView の代わりに Edittext を使用してください。そして、これが私のために働いているコードサンプルであり、うまくいくことを願っています。

<EditText
    android:id="@+id/locatie"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginRight="5dp"
    android:hint="locatie"
    android:textColor="#000000"
    android:lines="1"
    android:maxLength="32"
    android:digits="qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKJLZXCVBNM0123456789- "/>
于 2013-11-27T10:36:10.047 に答える