【发布时间】:2015-04-12 03:19:35
【问题描述】:
我想在 android 中制作this 类型的标签菜单。动态填充布局并居中对齐。
我该怎么做?
使用@Dory 推荐的库编辑
<FlowLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:f="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
f:debugDraw="false"
f:weightDefault="0"
f:layoutDirection="ltr"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="6dip"
android:paddingTop="6dip"
android:paddingRight="12dip"
android:paddingBottom="12dip"
android:background="@android:color/black"
android:id="@+id/l_flow"/>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"/>
一个xml文件中的Flowlayout按钮在另一个xml文件中。我正在充气 Button 然后 fLayout.addView(button);
what I get is this视图之间的顶部和底部填充高于预期
【问题讨论】:
-
我会尝试使用垂直线性布局。
-
这个库对你有用吗?
-
是的。我在下面回答了我的问题
标签: android flowlayout