2017-05-19 28 views
0

enter image description here如何設置的RatingBar和相對文本到另一個文本的Android

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/mainlayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="?android:attr/selectableItemBackground" 
    android:clickable="true" 
    android:focusable="true" 
    android:orientation="vertical"> 

    <RelativeLayout 
     android:id="@+id/relativelayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="20.5dp" 
     android:layout_marginRight="172dp" 
     android:layout_marginTop="31.5dp" 
     android:orientation="vertical"> 

     <TextView 
      android:id="@+id/title" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Mike Johnson" /> 

     <TextView 
      android:id="@+id/genre" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/title" 
      android:text="Mike Johnson" /> 

     <TextView 
      android:id="@+id/genre1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/genre" 
      android:text="Mike Johnson" 

      /> 


    </RelativeLayout> 


    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/relativelayout" 
     android:layout_marginTop="25.5px"> 

     <TextView 
      android:id="@+id/date" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="20.5dp" 
      android:layout_marginRight="175.09px" 
      android:layout_marginTop="7px" 
      android:layout_weight="1" 
      android:text="Feb 26,2016" /> 

     <TextView 
      android:id="@+id/ptitle" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/date" 
      android:layout_marginLeft="20.5dp" 
      android:layout_marginRight="150px" 
      android:text="GREAT SOCKS TO BUY" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/pdesc" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/ptitle" 
      android:layout_marginLeft="20.5dp" 
      android:layout_marginRight="20px" 
      android:layout_marginTop="14px" 
      android:text="asdsad asdasda saddfasdsad asdasdsadsa asdsadsadsar asdfdsfdsrf asddsfdsafds adssargfavcx " /> 

     <TextView 
      android:id="@+id/bottomline" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/pdesc" 
      android:layout_marginBottom="11px" 
      android:layout_marginLeft="20.5dp" 
      android:layout_marginTop="20px" 
      android:text="Yes i would like sklsadsa " /> 
    </RelativeLayout> 

    <RelativeLayout 
     android:id="@+id/textView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignTop="@+id/relativelayout"> 

     <RatingBar 
      android:id="@+id/rateM" 
      style="?android:attr/ratingBarStyleSmall" 
      android:layout_width="150dp" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:indeterminate="false" 
      android:isIndicator="true" 
      android:numStars="5" 
      android:stepSize="1.0" /> 

     <TextView 
      android:id="@+id/arrow" 
      android:layout_width="30dp" 
      android:layout_height="30dp" 
      android:layout_toLeftOf="@+id/rateM" 
      android:layout_alignParentRight="true" 
      android:text="4" /> 


    </RelativeLayout> 


</RelativeLayout> 

我想設置的評價欄恰到好處的文本視圖,其未來正確的,但theere其中4是評價吧,我想對ovelaping另一個文本請保持評級欄的文本正確,請告訴我如何實現這一點。我是個笨蛋。

+0

考慮使用'LinearLayout'來代替不同方向的內部'RelativeLayouts'。 –

回答

0

刪除以下從TextView的4

android:layout_toLeftOf="@+id/rateM" 

線和將其添加到等級欄

android:layout_toLeftOf="@+id/arrow" 

刪除以下從等級欄

android:layout_alignParentRight="true" 

和地點的TextView 4以上的評價小節線查看

+0

我改變了,但是門檻相同,什麼是箭頭@Ali Ahsan –

+0

我已經更新了答案。 –

相關問題