Display three lists in one Android activity by swiping or selecting an arrow button -


i have 15 data items in json. want display 6 items in android gridview, 6 items in view, , 3 items in third view in one activity only on swipe or selecting arrow towards right in android. how this?

why not use tablelayout , collapse columns onclick ?

let got 6 items in row on screen, , show first 3 items. (start collapsecolumns="3,4,5")

example:

tablelayout:

<tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/mytable" android:collapsecolumns="3,4,5">  <tablerow     android:layout_width="fill_parent"     android:layout_height="fill_parent">      <imageview         android:layout_width="wrap_content"         android:layout_height="100dp"         android:id="@+id/imageview"         android:layout_column="0"         android:background="@mipmap/ic_launcher_black"         android:layout_weight="1" />      <imageview         android:layout_width="wrap_content"         android:layout_height="100dp"         android:id="@+id/imageview2"         android:layout_column="1"         android:background="@mipmap/ic_launcher_black"         android:layout_weight="1" />      <imageview         android:layout_width="wrap_content"         android:layout_height="100dp"         android:id="@+id/imageview3"         android:layout_column="2"         android:background="@mipmap/ic_launcher_black"         android:layout_weight="1" />      <imageview         android:layout_width="wrap_content"         android:layout_height="100dp"         android:id="@+id/imageview4"         android:layout_column="3"         android:background="@mipmap/ic_launcher_white"         android:layout_weight="1" />      <imageview         android:layout_width="wrap_content"         android:layout_height="100dp"         android:id="@+id/imageview5"         android:layout_column="4"         android:background="@mipmap/ic_launcher_white"         android:layout_weight="1" />      <imageview         android:layout_width="wrap_content"         android:layout_height="100dp"         android:id="@+id/imageview6"         android:layout_column="5"         android:background="@mipmap/ic_launcher_white"         android:layout_weight="1" />  </tablerow>  <button     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="previous"     android:id="@+id/button1" />  <button     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="next"     android:id="@+id/button2" />  </tablelayout> 

and inside activity:

private tablelayout mtablelayout; 

and in oncreate()

findviewbyid(r.id.button1).setonclicklistener(new view.onclicklistener() {     @override     public void onclick(view v) {         mtablelayout.setcolumncollapsed(0,true);         mtablelayout.setcolumncollapsed(1,true);         mtablelayout.setcolumncollapsed(2,true);         mtablelayout.setcolumncollapsed(3,false);         mtablelayout.setcolumncollapsed(4,false);         mtablelayout.setcolumncollapsed(5,false);     } });  findviewbyid(r.id.button2).setonclicklistener(new view.onclicklistener() {     @override     public void onclick(view v) {         mtablelayout.setcolumncollapsed(0,false);         mtablelayout.setcolumncollapsed(1,false);         mtablelayout.setcolumncollapsed(2,false);         mtablelayout.setcolumncollapsed(3,true);         mtablelayout.setcolumncollapsed(4,true);         mtablelayout.setcolumncollapsed(5,true);     } }); 

really dunno if best/easiest way, works ;)

screenshots:

on start (or clicked next) on start

clicked previous: enter image description here

hope out, luck ;)


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -