MvvmCross:使用项目填充 MvxListView 默认情况下显示行之间的线
MvvmCross: Populating MvxListView with items displays line between rows by default
您好,我正在使用 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 中行之间的线吗?
感谢您的帮助。
尝试以下操作:
1) 如果要删除分隔线,请使用此代码:
android:divider="@null"
2) 如果要添加 space 而不是分隔线:
android:divider="@android:color/transparent"
android:dividerHeight="5dp"
您好,我正在使用 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 中行之间的线吗?
感谢您的帮助。
尝试以下操作:
1) 如果要删除分隔线,请使用此代码:
android:divider="@null"
2) 如果要添加 space 而不是分隔线:
android:divider="@android:color/transparent"
android:dividerHeight="5dp"