为什么我不能用 layout_toRightOf 放置视图 layout_alignParentRight="true" 的视图

Why I can't place view with layout_toRightOf the right of view with layout_alignParentRight="true"

我想放置一个 TextViewlayout_toRightOf 或一个 ImageViewlayout_alignParentRight="true"。为什么我看不到 TextView?如何解决这个问题。

我的问题代码!

<RelativeLayout
    android:orientation="horizontal"
    android:minWidth="20px"
    android:minHeight="20px"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/bottomBar">
    <ImageButton
        android:src="@drawable/likes"
        android:background="#ffffff"
        android:layout_width="25dp"
        android:layout_height="25dp"
        android:layout_marginRight="8dp"
        android:id="@+id/likeImage"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="15dp" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/likeImage"
        android:id="@+id/likeText" />
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_below="@+id/tv_progress">
        <ImageButton
            android:src="@drawable/coment"
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_marginRight="4dp"
            android:id="@+id/comment" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="4dp"
            android:id="@+id/commentText" />
    </LinearLayout>
    <ImageButton
     android:id="@+id/repostImage"
     android:background="#ffffff"
     android:src="@drawable/repost"
     android:layout_width="25dp"
     android:layout_height="25dp"
     android:layout_alignParentRight="true"
     android:layout_marginRight="45dp" />
    <TextView
      android:layout_toRightOf="@+id/repostImage"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="77"
      android:id="@+id/repostText" />
</RelativeLayout>

为什么我看不到文本“77”?

已找到解决方案,但 ImageView 尚未修复。因为固定 TextView

<ImageButton
       android:id="@+id/repostImage"
       android:layout_toLeftOf="@+id/repostText"
       android:background="#ffffff"
       android:src="@drawable/repost"
       android:layout_width="25dp"
       android:layout_height="25dp" />
<TextView
       android:layout_alignParentRight="true"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:id="@+id/repostText"
       android:layout_marginLeft="10dp"
       android:layout_marginRight="15dp" />

这是添加了问题的屏幕:

我的解决方案 只需用 android:layout_alignParentRight="true"

LinearLayout 中包装右键和文本视图

使用此代码

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     >
<LinearLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:gravity="center"
    android:layout_alignParentRight="true"
>
<ImageButton
    android:id="@+id/repostImage"
    android:background="#ffffff"
    android:src="@drawable/repost"
    android:layout_width="25dp"
    android:layout_height="25dp"
    android:layout_alignParentRight="true"
    android:layout_marginRight="45dp" />
 <TextView
    android:layout_toRightOf="@+id/repostImage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="77"
    android:id="@+id/repostText"
    android:layout_marginLeft="15dp" />
</LinearLayout>
</RelativeLayout>