矩形包围的文本视图在布局中有额外的空间

ni65a41a  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(109)

这就是我今天早些时候提出的问题:通过使用代码和编程方式设置宽度,重新创建xml文件中的形状
使用上面提供的解决方案,我能够得到预期的结果,但有一个小问题我无法解决。请帮帮我。
矩形框应该 Package 文本视图,无论其文本长度如何。但当内容比同一视图中的其他文本长时,会显示间隙。
以下是在“回收器”视图中加载的布局代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:id="@+id/lin1"
    android:weightSum="2">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/rel1"
        android:layout_marginLeft="5dp"
        android:layout_weight="1.50">
        <TextView
            android:id="@+id/list"
            android:textSize="@dimen/grid_row_text_size"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minWidth="100dp"
            android:textColor="@color/orange"
            android:textAlignment="center"
            android:singleLine="true"
            android:layout_marginRight="3dp"
            android:gravity="center">

        </TextView>

    </RelativeLayout>

    <ImageView
        android:id="@+id/info_icn"
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:layout_alignParentBottom="true"
        android:src="@drawable/eye"
        android:visibility="gone"
        android:layout_weight="0.50"
        android:layout_gravity="bottom"

        />

</LinearLayout>

这就是我现在得到的结果
欲了解更多关于该问题的信息,请参阅上面的另一张图片
这是我在更改顶部线性布局(android:layout\u width=“match\u parent”)后得到的结果
如果需要更多的代码,我可以在这里发布。请在这个问题上帮助我。谢谢!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题