使更多列表视图在Xamarin应用程序中同步滚动

问题描述 投票:0回答:1

在我的Xamarin应用程序中,我需要水平对齐3个列表视图。我需要3个列表,因为我需要能够单独单击列表中的项目(例如,我可以单击第一个列表的第二行并使该单元格更改颜色,并对第三个列表的第五行执行相同操作) 。但我需要始终对齐列表,即使我滚动一个列表。

想象一下,您在列表中间列出了我们销售的产品。左侧的列表显示了代理A对该产品的数量和价格,而右侧的列表则显示了代理B.

现在,客户可以查看中间列表中的产品,并且对应于该行,另外两个列表(在同一行上)将显示我们的2个代理商为该产品申请的价格以及可用的数量。

然后,客户可以点击代理A的列表行,如果他想从他那里购买该产品,并且他可能会点击代理B列表的另一行从他那里购买另一种产品。

每次单击时,相应的单元格将更改颜色,以便为客户端提供概述。然后,一旦完成,他将点击一个按钮向我们发送订单。因此,基本上用户需要能够独立地对列表进行操作,并且如果进行滚动以查看更多产品,则两个代理的列表将同步滚动以确保用户看到合适的价格并且非常重要。中间列表的给定行中该产品的数量。

我有以下内容,您可以看到我已将3个列表视图放在具有水平方向的线性布局中。如何确保列表在Xamarin中同步滚动?我看到了一些关于Java的问题,但我看不出如何将这些解决方案用于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>

c# xamarin xamarin.forms xamarin.ios xamarin.android
1个回答
0
投票

随着虚拟化和所有的魔术继续列表我认为这将是困难的,可能不可靠。

IMO你最好有一个列表并独立管理手势和单元格颜色等

我希望这有帮助

© www.soinside.com 2019 - 2024. All rights reserved.