我正在尝试构建一个涉及RecyclerView或GridView的UI,我想根据我动态填充的项目的数量和宽度自动设置列数.
这是迄今为止我所取得的成就......
这是我想要实现的目标......
我的项目布局xml
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:background="@drawable/hollow_white_background"
android:id="@+id/foodItemName"
android:text="PIZZA"
android:gravity="center"
android:textColor="@color/colorGray300"
android:textStyle="bold"
android:textSize="15sp"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
Run Code Online (Sandbox Code Playgroud)
请帮忙!