0

In my Xamarin app I need to have 3 list views horizontally aligned. I need 3 lists because I need to be able to click on items of the lists independently (for example I can click the second row of the first list and make that cell change color and do the same with the fifth row of the third list). But I need the lists to be always aligned, even when I scroll one list.

Imagine you have the list in the middle that lists products we sell. The list on the left shows the quantities and price that agent A has for that product, while the list on the right is for agent B.

Now the client can look at the product in the middle list, and corresponding to that row, the other two lists (on the same row) will show the price that our 2 agents are applying for that product and how much quantity the have available.

The client then can click on the row of the list for agent A if he wants to buy from him that product and it is possible that he will click on another row of the agent B list to buy from him another product.

At each click the corresponding cells will change color to give the client an overview. Then once he has done, he will click a button and send us an order. So basically the user need to be able to act on the lists independently and, if a scroll is done to view further product, it is important that the lists of the 2 agents will scroll in sync to ensure that the user sees the right price and quantity for that product in a given row of the middle list.

I have the following where you can see I have put the 3 list views in a linear layout with horizontal orientation. How can I make sure the lists scroll in sync in Xamarin? I saw some other question about Java but I can't see how to use those solutions for Xamarin.

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="horizontal"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:id="@+id/llContainer">
  <View
    android:layout_height="2dp"
    android:layout_width="match_parent"
    android:background="#000" />
  <LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:background="#009acd">
    <TextView
      android:text="Call"
      android:layout_height="wrap_content"
      android:layout_width="match_parent"
      android:layout_weight="1"
      android:gravity="center"
      android:textColor="#000"
      android:textStyle="bold"
      android:textSize="16sp" />
    <TextView
      android:text="Strike"
      android:layout_height="wrap_content"
      android:layout_width="match_parent"
      android:layout_weight="1"
      android:gravity="center"
      android:textColor="#000"
      android:textStyle="bold"
      android:textSize="16sp" />
    <TextView
     android:text="Put"
     android:layout_height="wrap_content"
     android:layout_width="match_parent"
     android:layout_weight="1"
     android:gravity="center"
     android:textColor="#000"
     android:textStyle="bold"
     android:textSize="16sp" />
  </LinearLayout>
  <View
    android:layout_height="2dp"
    android:layout_width="match_parent"
    android:background="#000" />
  <LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:background="#009acd">
    <ListView
      android:minWidth="25px"
      android:minHeight="25px"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:gravity="center"
      android:id="@+id/mListView1"
      android:divider="#00000000"
      android:dividerHeight="1dp" />
    <ListView
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:gravity="center"
    android:id="@+id/mListView2"
    android:divider="#00000000"
    android:dividerHeight="1dp" />
    <ListView
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:gravity="center"
    android:id="@+id/mListView3"
    android:divider="#00000000"
    android:dividerHeight="1dp" />

  </LinearLayout>
</LinearLayout>

Neelam Prajapati
  • 3,764
  • 3
  • 28
  • 62
opt
  • 477
  • 1
  • 10
  • 25

1 Answers1

0

With virtualisation and all the magic going on with a list i think this will be difficult and possibly unreliable.

IMO you are better off having one list and independently managing the gestures and cell colors ect

I hope this helps

TheGeneral
  • 79,002
  • 9
  • 103
  • 141
  • I added more details about why I need the lists to be independent (but still scroll together). Please let me know if that could still be achieved with a single list. Not sure how. – opt Dec 19 '17 at 11:10