MVVMCross gridview列宽

时间:2014-11-19 10:43:26

标签: mvvmcross multiple-columns

我想通过Mvxgridview显示5列,我有以下代码来设置gridview及其模板,但无法获得所需的结果。我只得到一列,即第一列显示在一行

<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="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF">
<Mvx.MvxGridView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/gridView1"
    local:MvxBind="ItemsSource Outages"
    local:MvxItemTemplate="@layout/item_outage"
    android:verticalSpacing="0dp"
    android:horizontalSpacing="0dp"
    android:stretchMode="columnWidth"
    android:numColumns="auto_fit"
    android:columnWidth="50dp"
    android:gravity="center" />

项目模板

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/relativeLayout1">
    <TextView
        android:text="Text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView1"
        local:MvxBind="Text Wtg" />
    <TextView
        android:text="Text 2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView2"
        local:MvxBind="Text StartTime"
        android:layout_toRightOf="@id/textView1" />
    <TextView
        android:text="Text 3"
        android:id="@+id/textView3"
        local:MvxBind="Text EndTime"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/textView2" />
    <TextView
        android:text="Text 4"
        android:id="@+id/textView4"
        local:MvxBind="Text Category"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/textView3" />
    <TextView
        android:text="Text 5"
        android:id="@+id/textView5"
        local:MvxBind="Text SubCategory"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/textView4" />
</RelativeLayout>

0 个答案:

没有答案