如何RecyclerView的item宽度设置

发布于 2022-09-03 15:21:49 字数 924 浏览 10 评论 0

item的布局:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <android.support.v7.widget.AppCompatButton
        android:layout_height="wrap_content"
        android:text="Text"
        android:id="@+id/at"
        android:layout_width="match_parent"/>

</LinearLayout>

RecyclerView:

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical"/>

运行截图:
图片描述

求解。。。。

还有一个问题为什么AppCompatButton本来是小写问什么运行成大写了。。

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

三五鸿雁 2022-09-10 15:21:49

大小写问题需要设置下属性android:textAllCaps为false

只为守护你 2022-09-10 15:21:49

看下你的onCreateViewHolder

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文