Xamarin ListView:构造函数和模拟器之间的区别
Xamarin ListView: difference between constructor and emulator
我有以下网格布局
<?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 的高度,如第一个图片所示?
我找到了一种解决此问题的方法,方法是从 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>
我有以下网格布局
<?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 的高度,如第一个图片所示?
我找到了一种解决此问题的方法,方法是从 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>