2013-12-10 19 views
1

我試圖通過側設置兩個textviews側:設置機器人:layout_toRightOf =引起的TextView消失

  • userVideouploaderTextView
  • userVideoviewsTextView

但是如果我設置的userVideouploaderTextViewandroid:layout_toRightOf="@id/userVideouploaderTextView",我有問題。

userVideoviewsTextView消失。

這裏是我的佈局代碼:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <com.idg.omv.ui.widget.UrlImageView 
     android:id="@+id/userVideoThumbImageView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="@android:color/black" 
     android:clickable="false" 
     android:contentDescription="YouTube video thumbnail" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:gravity="center" 
     android:scaleType="fitCenter" 
     android:src="@drawable/ic_launcher" /> 

    <View 
     android:layout_width="match_parent" 
     android:layout_height="2dp" 
     android:visibility="invisible" /> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/userVideoTitleTextView" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:paddingLeft="5dip" 
      android:text="Video Title Not Found" 
      android:textColor="@android:color/black" 
      android:textSize="20sp" /> 

     <Button 
      android:id="@+id/fav_up_btn1" 
      android:layout_width="27dp" 
      android:layout_height="27dp" 
      android:layout_alignParentRight="true" 
      android:background="@drawable/fav_up_btn1" 
      android:clickable="false" 
      android:focusable="false" 
      android:focusableInTouchMode="false" 
      android:gravity="right" 
      android:paddingRight="5dp" 
      android:paddingTop="5dp" /> 
    </RelativeLayout> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" > 

     <TextView 
      android:id="@+id/userVideouploaderTextView" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:textColor="@android:color/black" 
      android:textSize="16sp" /> 

     <TextView 
      android:id="@+id/userVideoviewsTextView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@id/userVideouploaderTextView" 
      android:textColor="@android:color/black" 
      android:textSize="14sp" /> 
    </RelativeLayout> 

    <View 
     android:layout_width="match_parent" 
     android:layout_height="11dp" 
     android:visibility="invisible" /> 

</LinearLayout> 

回答

1

因爲你的觀點userVideouploaderTextViewwidth="fill_parent"變化wrap_content或固定DP