簡體   English   中英

未顯示TextView /相對布局

[英]TextView not being displayed / Relative Layout

對於某些人來說,這似乎是一個非常簡單的問題,但是即使嘗試了本網站上提出的許多解決方案,我也找不到找到顯示TextView的方法。 並非我正在使用Android的內置Eclipse XML工具,並且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>

到目前為止,所有其他元素都可以正確顯示。 任何幫助將不勝感激!

謝謝

您在哪里想要textView?

我會松開這兩個:

layout_alignBaseline="@+id/launch_button

layout_alignBottom="@+id/launch_button

並使用以下之一:

layout_below="@+id/launch_button

layout_above="@+id/launch_button

它將放置在按鈕上方或下方。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM