【问题标题】:MvvmCross: Populating MvxListView with items displays line between rows by defaultMvvmCross:使用项目填充 MvxListView 默认显示行之间的线
【发布时间】:2015-11-19 14:18:36
【问题描述】:

您好,我正在使用 MvvmCross 进行 Xamarin Android 开发,到目前为止它还不错。我正在使用 MvxListView 在我的 ViewModel 中填充 ObservableCollection,它工作得很好。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginStart="8dp"
    android:layout_marginEnd="8dp">
    <Mvx.MvxListView
        android:id="@+id/chat_list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        local:MvxItemTemplate="@layout/chat_conversation"
        local:MvxBind="ItemsSource Items; SelectedItem SelectedRecipient; ItemClick ItemSelectedCommand" />
</LinearLayout>

但现在我想对使用的 MvxListView 模板进行样式化,它总是在我没有在项目模板中绘制的行之间显示一条线。

chat_conversation.axml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ImageView
        android:id="@+id/profile_pic"
        android:layout_height="35dp"
        android:layout_width="35dp"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_marginTop="8dp"
        android:src="@drawable/Icon"
        local:MvxBind="Src Thumbnail,Converter=StreamToBitmap" />
    <TextView
        android:id="@+id/chat_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        android:padding="10dp"
        android:textColor="#030303"
        android:background="@drawable/chat_bubble_other"
        android:shadowDx="1"
        android:shadowDy="1"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_toEndOf="@id/profile_pic" />
</RelativeLayout>

有人知道如何消除 MvxListView 中的行之间的线吗?

感谢您的帮助。

【问题讨论】:

    标签: android android-layout xamarin xamarin.android mvvmcross


    【解决方案1】:

    尝试以下方法:

    1) 如果要删除分隔线,请使用以下代码:

    android:divider="@null"
    

    2) 如果你想添加空格而不是分隔线:

    android:divider="@android:color/transparent"
    android:dividerHeight="5dp"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-09
      • 1970-01-01
      • 1970-01-01
      • 2017-06-05
      • 2015-11-27
      相关资源
      最近更新 更多