Answer the question
In order to leave comments, you need to log in
Android. Split content into two columns?
Is it possible to get such result without using ListView, RecyclerView etc.
Now I do it like this:
xml:
...
<LinearLayout
android:id="@+id/cardContainer"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true">
</LinearLayout>
...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#ffebebeb">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:layout_margin="15dp">
</android.support.v7.widget.CardView>
</LinearLayout>
CardLayout = (LinearLayout) findViewById(R.id.cardContainer);
cell = getLayoutInflater().inflate(R.layout.one_list_item, null);
...
CardLayout.addView(cell);
Answer the question
In order to leave comments, you need to log in
If you don't want to use RecyclerView and GridView, you can use GridLayout with two columns, but I suspect you want two independent scrolling lists. But as far as I understand, your content is limited, and even if not and you don’t want to use AdapterView / RecyclerView descendants, you can use this layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Space
android:id="@+id/center_space"
android:layout_centerInParent="true"
android:layout_width="0dp"
android:layout_height="0dp" />
<ScrollView
android:id="@+id/start_scroll_view"
android:layout_toStartOf="@id/center_space"
android:layout_alignParentStart="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/start_container_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ScrollView>
<ScrollView
android:id="@+id/end_scroll_view"
android:layout_toEndOf="@id/center_space"
android:layout_alignParentEnd="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/end_container_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ScrollView>
</RelativeLayout>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question