xml - 如何将 Windows Phone 8.1 布局转换为 Android?
xml - How to convert Windows Phone 8.1 layout to Android?
这是我的 Windows Phone 布局...
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
我的问题是:如何在android中实现这种布局?
我的期望: 我想要 android 中的两个部分。第一部分将包含编辑框并且可以滚动,第二部分将仅包含一个按钮,我希望它始终显示。意味着它不会随表格滚动。
截图如下:
提前致谢
I want 2nd row to take space according to its items inside it and rest of space should be given to first row.
在这种情况下,由 children 决定他们占用多少 space,因为网格视图只是定义所有项目的整体容器
<GridLayout android:id="@+id/the_grid"
android:rowCount="2" android:columnCount="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<ImageView android:layout_height="match_parent"
android:layout_width="wrap_content" />
<TextView android:layout_height="match_parent"
android:layout_width="wrap_content" />
</GridLayout>
或者,您可能会发现线性布局效果更好,但为了确保顶行保持为一行,您将不得不使用固定高度
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:layout_height="56dp"
android:layout_width="wrap_content" />
<ImageView android:layout_height="match_parent"
android:layout_width="wrap_content" />
</LinearLayout>
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:layout_height="56dp"
android:layout_width="wrap_content" />
<TextView android:layout_height="match_parent"
android:layout_width="wrap_content" />
</LinearLayout>
</LinearLayout >
这是我的 Windows Phone 布局...
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
我的问题是:如何在android中实现这种布局?
我的期望: 我想要 android 中的两个部分。第一部分将包含编辑框并且可以滚动,第二部分将仅包含一个按钮,我希望它始终显示。意味着它不会随表格滚动。
截图如下:
提前致谢
I want 2nd row to take space according to its items inside it and rest of space should be given to first row.
在这种情况下,由 children 决定他们占用多少 space,因为网格视图只是定义所有项目的整体容器
<GridLayout android:id="@+id/the_grid"
android:rowCount="2" android:columnCount="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<ImageView android:layout_height="match_parent"
android:layout_width="wrap_content" />
<TextView android:layout_height="match_parent"
android:layout_width="wrap_content" />
</GridLayout>
或者,您可能会发现线性布局效果更好,但为了确保顶行保持为一行,您将不得不使用固定高度
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:layout_height="56dp"
android:layout_width="wrap_content" />
<ImageView android:layout_height="match_parent"
android:layout_width="wrap_content" />
</LinearLayout>
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:layout_height="56dp"
android:layout_width="wrap_content" />
<TextView android:layout_height="match_parent"
android:layout_width="wrap_content" />
</LinearLayout>
</LinearLayout >