2017-02-22 47 views
0

我的疑問是如何allign的imageview的並且TextView的的RelativeLayout的任何其它或佈局我想裏面同樣間距但未能成功在它讓我後我的代碼是我迄今嘗試:如何在relativelayout android中同等設置imageview間距?

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/swiperefresh" 
    tools:context=".Activities.VisitView" 
    android:background="#e3e3e3"> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:orientation="horizontal" 
    android:id="@+id/parent" 
    android:background="#e3e3e3" 
    android:layout_height="match_parent"> 
    <RelativeLayout 
     android:layout_width="match_parent" 
     android:background="#fff" 
     android:layout_margin="20dp" 
     android:id="@+id/child" 
     android:layout_height="wrap_content"> 

    <RelativeLayout 
     android:layout_width="wrap_content" 

     android:id="@+id/first" 
     android:layout_height="wrap_content"> 
     <de.hdodenhof.circleimageview.CircleImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="10dp" 
      android:layout_marginTop="5dp" 
     android:id="@+id/e" 
     android:layout_centerHorizontal="true" 
     android:src="@drawable/ic_downloads"/> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Download" 
     android:layout_marginTop="5dp" 
     android:layout_marginLeft="10dp" 
     android:layout_centerHorizontal="true" 
     android:textSize="12sp" 
     android:layout_below="@+id/e"/> 
    </RelativeLayout> 
    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/first" 
     android:layout_marginLeft="10dp" 
     android:id="@+id/second"> 
     <de.hdodenhof.circleimageview.CircleImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="10dp" 
      android:layout_marginTop="5dp" 
      android:id="@+id/e1" 
      android:layout_centerHorizontal="true" 
      android:src="@drawable/ic_up_arrow"/> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Upload" 
      android:layout_centerHorizontal="true" 

      android:layout_marginTop="5dp" 
      android:textSize="12sp" 
      android:layout_marginLeft="10dp" 
      android:layout_below="@+id/e1"/> 

    </RelativeLayout> 
     <RelativeLayout 
      android:layout_marginLeft="10dp" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/second" 
      android:id="@+id/third"> 
      <de.hdodenhof.circleimageview.CircleImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:layout_marginTop="5dp" 
       android:id="@+id/e3" 
       android:layout_centerHorizontal="true" 
       android:src="@drawable/ic_up_arrow"/> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Print" 
       android:layout_centerHorizontal="true" 

       android:layout_marginTop="5dp" 
       android:textSize="12sp" 
       android:layout_marginLeft="10dp" 
       android:layout_below="@+id/e3"/> 

     </RelativeLayout> 
     <RelativeLayout 
      android:layout_marginLeft="10dp" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/third" 
      android:id="@+id/four"> 
      <de.hdodenhof.circleimageview.CircleImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:layout_marginTop="5dp" 
       android:id="@+id/e4" 
       android:layout_centerHorizontal="true" 
       android:src="@drawable/ic_up_arrow"/> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Notes" 
       android:layout_centerHorizontal="true" 

       android:layout_marginTop="5dp" 
       android:textSize="12sp" 
       android:layout_marginLeft="10dp" 
       android:layout_below="@+id/e4"/> 

     </RelativeLayout> 
    </RelativeLayout> 
    <android.support.v7.widget.RecyclerView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/child" 
     android:layout_marginTop="5dp" 
     android:id="@+id/visit" 
     android:layout_marginBottom="5dp" 
     android:divider="#e3e3e3" 
     android:keepScreenOn="true" 
     android:scrollbars="vertical" 
     android:dividerHeight="0.5dp" 
     /> 

</RelativeLayout> 
</android.support.v4.widget.NestedScrollView> 

但textview和imageview沒有正確地在相對佈局內部進行匹配,這是圖像enter image description here

如何正確地對齊此圖像和textview預先感謝!

+2

嘗試使用'LinearLayout'用'weight' –

+0

你不能這樣做,因爲你的文字是不同的。爲此,必須設置Relativelayout –

+0

yes @PhanVanLinh右側的固定高度寬度。您還可以使用帶有weightSum的Main LinearLayout和帶有權重的Inner LinearLayout –

回答

1

試試這個,

<?xml version="1.0" encoding="utf-8"?> 
    <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/swiperefresh" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 

     android:background="#e3e3e3"> 

     <RelativeLayout 
      android:id="@+id/parent" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#e3e3e3" 
      android:orientation="horizontal"> 

      <LinearLayout 
       android:id="@+id/child" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="20dp" 
       android:background="#fff" 
       android:orientation="horizontal"> 

       <RelativeLayout 
        android:id="@+id/first" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_weight="1"> 

        <de.hdodenhof.circleimageview.CircleImageView 
         android:id="@+id/e" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_centerHorizontal="true" 
         android:layout_marginLeft="10dp" 
         android:layout_marginTop="5dp" 
         android:src="@drawable/ic_up_arrow" /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_below="@+id/e" 
         android:layout_centerHorizontal="true" 
         android:layout_marginLeft="10dp" 
         android:layout_marginTop="5dp" 
         android:text="Download" 
         android:textSize="12sp" /> 
       </RelativeLayout> 

       <RelativeLayout 
        android:id="@+id/second" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:layout_weight="1"> 

        <de.hdodenhof.circleimageview.CircleImageView 
         android:id="@+id/e1" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_centerHorizontal="true" 
         android:layout_marginLeft="10dp" 
         android:layout_marginTop="5dp" 
         android:src="@drawable/ic_up_arrow" /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_below="@+id/e1" 
         android:layout_centerHorizontal="true" 

         android:layout_marginLeft="10dp" 
         android:layout_marginTop="5dp" 
         android:text="Upload" 
         android:textSize="12sp" /> 

       </RelativeLayout> 

       <RelativeLayout 
        android:id="@+id/third" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:layout_weight="1"> 

        <de.hdodenhof.circleimageview.CircleImageView 
         android:id="@+id/e3" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_centerHorizontal="true" 
         android:layout_marginLeft="10dp" 
         android:layout_marginTop="5dp" 
         android:src="@drawable/ic_up_arrow" /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_below="@+id/e3" 
         android:layout_centerHorizontal="true" 

         android:layout_marginLeft="10dp" 
         android:layout_marginTop="5dp" 
         android:text="Print" 
         android:textSize="12sp" /> 

       </RelativeLayout> 

       <RelativeLayout 
        android:id="@+id/four" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:layout_weight="1"> 

        <de.hdodenhof.circleimageview.CircleImageView 
         android:id="@+id/e4" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_centerHorizontal="true" 
         android:layout_marginLeft="10dp" 
         android:layout_marginTop="5dp" 
         android:src="@drawable/ic_up_arrow" /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_below="@+id/e4" 
         android:layout_centerHorizontal="true" 

         android:layout_marginLeft="10dp" 
         android:layout_marginTop="5dp" 
         android:text="Notes" 
         android:textSize="12sp" /> 

       </RelativeLayout> 
      </LinearLayout> 

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/visit" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_below="@+id/child" 
       android:layout_marginBottom="5dp" 
       android:layout_marginTop="5dp" 
       android:divider="#e3e3e3" 
       android:dividerHeight="0.5dp" 
       android:keepScreenOn="true" 
       android:scrollbars="vertical" /> 

     </RelativeLayout> 
    </android.support.v4.widget.NestedScrollView> 
0

試試這個

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/swiperefresh" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#e3e3e3" 
    tools:context=".Activities.VisitView"> 

    <RelativeLayout 
     android:id="@+id/parent" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="#e3e3e3" 
     android:orientation="horizontal"> 

     <LinearLayout 
      android:id="@+id/child" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="20dp" 
      android:background="#fff" 
      android:orientation="horizontal"> 

      <RelativeLayout 
       android:id="@+id/first" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="1"> 

       <de.hdodenhof.circleimageview.CircleImageView 
        android:id="@+id/e" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerHorizontal="true" 
        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:src="@drawable/ic_downloads" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/e" 
        android:layout_centerHorizontal="true" 
        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:text="Download" 
        android:textSize="12sp" /> 
      </RelativeLayout> 

      <RelativeLayout 
       android:id="@+id/second" 

       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:layout_toRightOf="@+id/first" 
       android:layout_weight="1"> 

       <de.hdodenhof.circleimageview.CircleImageView 
        android:id="@+id/e1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerHorizontal="true" 
        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:src="@drawable/ic_up_arrow" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/e1" 
        android:layout_centerHorizontal="true" 

        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:text="Upload" 
        android:textSize="12sp" /> 

      </RelativeLayout> 

      <RelativeLayout 
       android:id="@+id/third" 

       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:layout_toRightOf="@+id/second" 
       android:layout_weight="1"> 

       <de.hdodenhof.circleimageview.CircleImageView 
        android:id="@+id/e3" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerHorizontal="true" 
        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:src="@drawable/ic_up_arrow" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/e3" 
        android:layout_centerHorizontal="true" 

        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:text="Print" 
        android:textSize="12sp" /> 

      </RelativeLayout> 

      <RelativeLayout 
       android:id="@+id/four" 

       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:layout_toRightOf="@+id/third" 
       android:layout_weight="1"> 

       <de.hdodenhof.circleimageview.CircleImageView 
        android:id="@+id/e4" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerHorizontal="true" 
        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:src="@drawable/ic_up_arrow" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/e4" 
        android:layout_centerHorizontal="true" 

        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:text="Notes" 
        android:textSize="12sp" /> 

      </RelativeLayout> 
     </LinearLayout> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/visit" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/child" 
      android:layout_marginBottom="5dp" 
      android:layout_marginTop="5dp" 
      android:divider="#e3e3e3" 
      android:dividerHeight="0.5dp" 
      android:keepScreenOn="true" 
      android:scrollbars="vertical" /> 

    </RelativeLayout> 
</android.support.v4.widget.NestedScrollView> 
0
<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/swiperefresh" 
android:background="#e3e3e3"> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:orientation="horizontal" 
    android:id="@+id/parent" 
    android:background="#e3e3e3" 
    android:layout_height="match_parent"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:background="#fff" 
     android:layout_margin="20dp" 
     android:orientation="horizontal" 
     android:id="@+id/child" 
     android:layout_height="wrap_content"> 

     <RelativeLayout 
      android:id="@+id/first" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1"> 
      <de.hdodenhof.circleimageview.CircleImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:layout_marginTop="5dp" 
       android:id="@+id/e" 
       android:layout_centerHorizontal="true" 
       android:src="@drawable/inactive_settings"/> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Download" 
       android:layout_marginTop="5dp" 
       android:layout_marginLeft="10dp" 
       android:layout_centerHorizontal="true" 
       android:textSize="12sp" 
       android:layout_below="@+id/e"/> 
     </RelativeLayout> 
     <RelativeLayout 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:layout_toRightOf="@+id/first" 
      android:layout_marginLeft="10dp" 
      android:id="@+id/second"> 
      <de.hdodenhof.circleimageview.CircleImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:layout_marginTop="5dp" 
       android:id="@+id/e1" 
       android:layout_centerHorizontal="true" 
       android:src="@drawable/inactive_settings"/> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Upload" 
       android:layout_centerHorizontal="true" 

       android:layout_marginTop="5dp" 
       android:textSize="12sp" 
       android:layout_marginLeft="10dp" 
       android:layout_below="@+id/e1"/> 

     </RelativeLayout> 
     <RelativeLayout 
      android:layout_marginLeft="10dp" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:layout_toRightOf="@+id/second" 
      android:id="@+id/third"> 
      <de.hdodenhof.circleimageview.CircleImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:layout_marginTop="5dp" 
       android:id="@+id/e3" 
       android:layout_centerHorizontal="true" 
       android:src="@drawable/inactive_settings"/> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Print" 
       android:layout_centerHorizontal="true" 

       android:layout_marginTop="5dp" 
       android:textSize="12sp" 
       android:layout_marginLeft="10dp" 
       android:layout_below="@+id/e3"/> 

     </RelativeLayout> 
     <RelativeLayout 
      android:layout_marginLeft="10dp" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:layout_toRightOf="@+id/third" 
      android:id="@+id/four"> 
      <de.hdodenhof.circleimageview.CircleImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:layout_marginTop="5dp" 
       android:id="@+id/e4" 
       android:layout_centerHorizontal="true" 
       android:src="@drawable/inactive_settings"/> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Notes" 
       android:layout_centerHorizontal="true" 

       android:layout_marginTop="5dp" 
       android:textSize="12sp" 
       android:layout_marginLeft="10dp" 
       android:layout_below="@+id/e4"/> 

     </RelativeLayout> 
    </LinearLayout> 
    <android.support.v7.widget.RecyclerView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/child" 
     android:layout_marginTop="5dp" 
     android:id="@+id/visit" 
     android:layout_marginBottom="5dp" 
     android:divider="#e3e3e3" 
     android:keepScreenOn="true" 
     android:scrollbars="vertical" 
     android:dividerHeight="0.5dp" 
     /> 

</RelativeLayout> 

0

使用的LinearLayout與重量之和:

<RelativeLayout 
     android:layout_width="match_parent" 
     android:orientation="horizontal" 
     android:id="@+id/parent" 
     android:background="#e3e3e3" 
     android:layout_height="match_parent"> 
     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:background="#fff" 
      android:layout_margin="20dp" 
      android:id="@+id/child" 
      android:weightSum="4" 
      android:layout_height="wrap_content"> 

      <RelativeLayout 
       android:layout_weight="1" 
       android:layout_width="wrap_content" 
       android:id="@+id/first" 
       android:layout_height="wrap_content"> 
       <de.hdodenhof.circleimageview.CircleImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:id="@+id/e" 
        android:layout_centerHorizontal="true" 
        android:src="@drawable/ic_downloads"/> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Download" 
        android:layout_marginTop="5dp" 
        android:layout_marginLeft="10dp" 
        android:layout_centerHorizontal="true" 
        android:textSize="12sp" 
        android:layout_below="@+id/e"/> 
      </RelativeLayout> 
      <RelativeLayout 
       android:layout_weight="1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/first" 
       android:layout_marginLeft="10dp" 
       android:id="@+id/second"> 
       <de.hdodenhof.circleimageview.CircleImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:id="@+id/e1" 
        android:layout_centerHorizontal="true" 
        android:src="@drawable/ic_up_arrow"/> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Upload" 
        android:layout_centerHorizontal="true" 

        android:layout_marginTop="5dp" 
        android:textSize="12sp" 
        android:layout_marginLeft="10dp" 
        android:layout_below="@+id/e1"/> 

      </RelativeLayout> 
      <RelativeLayout 
       android:layout_weight="1" 
       android:layout_marginLeft="10dp" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/second" 
       android:id="@+id/third"> 
       <de.hdodenhof.circleimageview.CircleImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:id="@+id/e3" 
        android:layout_centerHorizontal="true" 
        android:src="@drawable/ic_up_arrow"/> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Print" 
        android:layout_centerHorizontal="true" 

        android:layout_marginTop="5dp" 
        android:textSize="12sp" 
        android:layout_marginLeft="10dp" 
        android:layout_below="@+id/e3"/> 

      </RelativeLayout> 
      <RelativeLayout 
       android:layout_weight="1" 
       android:layout_marginLeft="10dp" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/third" 
       android:id="@+id/four"> 
       <de.hdodenhof.circleimageview.CircleImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:layout_marginTop="5dp" 
        android:id="@+id/e4" 
        android:layout_centerHorizontal="true" 
        android:src="@drawable/ic_up_arrow"/> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Notes" 
        android:layout_centerHorizontal="true" 

        android:layout_marginTop="5dp" 
        android:textSize="12sp" 
        android:layout_marginLeft="10dp" 
        android:layout_below="@+id/e4"/> 

      </RelativeLayout> 
     </LinearLayout> 
     <android.support.v7.widget.RecyclerView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/child" 
      android:layout_marginTop="5dp" 
      android:id="@+id/visit" 
      android:layout_marginBottom="5dp" 
      android:divider="#e3e3e3" 
      android:keepScreenOn="true" 
      android:scrollbars="vertical" 
      android:dividerHeight="0.5dp" 
      /> 

    </RelativeLayout> 
</android.support.v4.widget.NestedScrollView> 
0

請參考這一點,實現相對layout.Place內的線性佈局到位相對佈局我的圖像視圖的圖像視圖。

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/relativeLayout2" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentStart="true"> 

    <LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="50dp"> 


    <ImageView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     app:srcCompat="@drawable/tv" 
     android:id="@+id/starImage" /> 

    <ImageView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     app:srcCompat="@drawable/music" 
     android:id="@+id/callImage" /> 

    <ImageView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     app:srcCompat="@drawable/books" 
     android:id="@+id/shareImage" /> 

    <ImageView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     app:srcCompat="@drawable/block_icon" 
     android:id="@+id/blockImage" /> 

    <ImageView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     app:srcCompat="@drawable/edit" 
     android:id="@+id/deleteimage" /> 
</LinearLayout> 

輸出將lokk這樣。

enter image description here

相關問題