Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to make two way view with 2 rows

I am using LucasR TwoWayView. I want the View to have 2 rows and multiple columns.

enter image description here

Like the 4th Image in this picture except with 2 rows instead of 3. I tried many things but no use.

Here is my Layout:

<?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>

This is the Gradle Compilation:

compile 'org.lucasr.twowayview:twowayview:0.1.4'

But its not at all displaying 2 rows. Instead coming one single row with all the items. Please help.

like image 746
Akshat Avatar asked Oct 28 '15 10:10

Akshat


1 Answers

<?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>

Use Horizontal orientation for inner LinearLayout

like image 165
Sathish Kumar Avatar answered Oct 18 '22 00:10

Sathish Kumar