RecyclerView使用问题

昵__称 昵__称 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在界面上使用了RecyclerView
在Fragment中的布局是
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/blue_18"
android:orientation="horizontal">

<TextView
style="@style/TextBlack22"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="@dimen/padding_def"
android:text="编号"
android:textColor="@color/white"/>

<TextView
style="@style/TextBlack22"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="@dimen/padding_def"
android:text="城市"
android:textColor="@color/white"/>

<TextView
style="@style/TextBlack22"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="@dimen/padding_def"
android:text="AQI"
android:textColor="@color/white"/>

<TextView
style="@style/TextBlack22"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="@dimen/padding_def"
android:text="首要污染物"
android:textColor="@color/white"/>
</LinearLayout>

<android.support.v7.widget.RecyclerView
android:id="@id/rvCity"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

item 的布局文件是
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<TextView
android:id="@id/tvCityCode"
style="@style/TextBlack22"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="@dimen/padding_def"/>

<TextView
android:id="@id/tvCityName"
style="@style/TextBlack22"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="@dimen/padding_def"/>

<TextView
android:id="@id/tvCityAQI"
style="@style/TextBlack22"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="@dimen/padding_def"/>

<TextView
android:id="@id/tvCityPrimaryPollutant"
style="@style/TextBlack22"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="@dimen/padding_def"/>

</LinearLayout>

本来我以为RecyclerView里面的数据应该是平均的展示数据。但是实际上是这样的

怎样才能让他平均的展示数据?
...全文

相关推荐

评论 1
收藏 已收藏
分享
返回顶部
昵__称
Android 80,490 成员 91,375 内容