我正在使用LucasR TwoWayView。我希望View有2行和多列。
就像这张照片中的第4张图片一样,除了2行而不是3行。我尝试过很多东西但没用。
这是我的布局:
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/categoryItems"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<org.lucasr.twowayview.TwoWayView
android:id="@+id/filterGrid"
style="@style/TwoWayView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_small"
android:drawSelectorOnTop="false"
app:twowayview_numRows="3"
app:twowayview_layoutManager="GridLayoutManager" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#d3d3d3" />
</LinearLayout>
这是Gradle编译:
compile 'org.lucasr.twowayview:twowayview:0.1.4'
但它根本没有显示2行。而是将所有项目都放在一行中。请帮忙。
答案 0 :(得分:1)
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/categoryItems"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="visible">
<org.lucasr.twowayview.TwoWayView
android:id="@+id/filterGrid"
style="@style/TwoWayView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_small"
android:drawSelectorOnTop="false"
app:twowayview_numRows="3"
app:twowayview_layoutManager="GridLayoutManager" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#d3d3d3" />
</LinearLayout>
对内部LinearLayout