1

これは、一部の人にとっては非常に簡単な質問のように思えるかもしれませんが、このサイトで提案されている多数のソリューションを試しても、TextViewを表示する方法が見つかりません。Android用の組み込みのEclipseXMLツールを使用しているわけではなく、TextViewがこのグラフィカルレイアウトに表示されているわけではありません。これが私がこれまでに得たものです:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<ImageView
    android:contentDescription="@string/no_of_screens"
    android:id="@+id/imageViewHome"
    android:layout_width="290dp"
    android:layout_height="212dp"
    android:layout_gravity="center_horizontal"
    android:paddingTop="40dp"
    android:src="@drawable/logo" />

<RelativeLayout
    android:id="@+id/relativeid"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1" >

    <Button
        android:id="@+id/launch_button"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="80dp"
        android:text="@string/launch" />

    <Spinner
        android:id="@+id/spinner1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/launch_button"
        android:layout_marginRight="20dp"
        android:layout_toLeftOf="@+id/launch_button"
        android:entries="@array/num_array"
        android:prompt="@string/screen_prompt"
        android:textSize="8pt" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/launch_button"
        android:layout_alignBottom="@+id/launch_button"
        android:layout_marginRight="16dp"
        android:layout_toLeftOf="@+id/spinner1"
        android:text="@string/no_of_screens"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</RelativeLayout>

</LinearLayout>

今のところ、他のすべての要素は正しく表示されています。どんな助けでも大歓迎です!

ありがとう

4

1 に答える 1

1

textViewはどこに置きますか?

私はこれらの2つを失うでしょう:

layout_alignBaseline="@+id/launch_button

layout_alignBottom="@+id/launch_button

次のいずれかを使用します。

layout_below="@+id/launch_button

layout_above="@+id/launch_button

ボタンの上または下に配置されます。

于 2012-06-13T14:24:56.043 に答える