百分比布局
新增两条包依赖:
implementation 'com.android.support:appcompat-v7:29.0.0'
implementation 'com.android.support:percent:29.0.0'
布局定义使用androidx:
<androidx.percentlayout.widget.PercentFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.percentlayout.widget.PercentFrameLayout>
RecyclerView
新增一条包依赖:
implementation 'com.android.support:recyclerview-v7:29.0.0'
布局定义:
<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:layout_height="match_parent"
>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>

本文详细介绍如何在Android项目中实现百分比布局,通过引入appcompat-v7与percent库,并展示了具体的XML布局代码。同时,文章还介绍了如何使用RecyclerView,包括必要的包依赖以及RecyclerView的布局定义。

7623

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



