修改activity_hot_city.xml布局文件,完整代码如下,复制粘贴即可
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
xmlns:tools=“http://schemas.android.com/tools”
android:layout_width=“match_parent”
android:fitsSystemWindows=“true”
android:id=“@+id/lay_bg”
android:orientation=“vertical”
android:layout_height=“match_parent”
tools:context=“.ui.HotCityActivity”>
<androidx.appcompat.widget.Toolbar
android:id=“@+id/toolbar”
android:layout_width=“match_parent”
android:layout_height=“?attr/actionBarSize”
android:background=“@color/white”
app:layout_constraintEnd_toEndOf=“parent”
app:navigationIcon=“@mipmap/icon_return”
app:contentInsetLeft=“@dimen/dp_16”
app:layout_constraintLeft_toLeftOf=“parent”
app:layout_constraintTop_toTopOf=“parent”
app:popupTheme=“@style/AppTheme.PopupOverlay”>
<TextView
android:id=“@+id/tv_title”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_gravity=“center”
android:textSize=“@dimen/sp_16”
android:textColor=“@color/black”
android:text=“热门城市” />
</androidx.appcompat.widget.Toolbar>
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/rv”
android:layout_width=“match_parent”
android:layout_height=“match_parent”/>
修改的布局有什么变化呢?就是里面的布局增加了id,还有就是改了颜色,
之后在HotCityActivity中初始化

上图中标出来的就是新增的,

最低0.47元/天 解锁文章
3869

被折叠的 条评论
为什么被折叠?



