Xamarin ListView:构造函数和模拟器之间的区别

时间:2017-09-16 16:44:02

标签: android listview xamarin height

我有以下网格布局

<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:columnCount="1"
    android:rowCount="5">
    <ListView
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_rowWeight="0.7"
        android:layout_width="match_parent" />
    <TextView
        android:text="Введите показания водомера"
        android:textSize="24dp"
        android:layout_rowWeight="0.05"
        android:layout_width="match_parent"
        android:gravity="center"/>
    <EditText
        android:inputType="number"
        android:layout_rowWeight="0.03"
        android:layout_width="match_parent" />
    <Button
        android:text="Сделать фото"
        android:textSize="20dp"
        android:layout_rowWeight="0.05"
        android:layout_width="match_parent"
        android:gravity="center" />
    <Button
        android:text="Отправить показания"
        android:textSize="24dp"
        android:layout_rowWeight="0.15"
        android:layout_width="match_parent"
        android:gravity="center" />
</GridLayout>

在Vs构造函数中,它看起来像 this。 但在模拟器中我得到了this。 如何在第一张图像上设置ListView的高度?

1 个答案:

答案 0 :(得分:0)

我找到了一种方法来解决这个问题,方法是将nuget中的自定义android.support.v7添加到我的项目中,并在xml中使用它的模式。

<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:columnCount="1"
    app:rowCount="5">
</android.support.v7.widget.GridLayout>