zoukankan      html  css  js  c++  java
  • Xamarin TableLayout

    TableLayoutViewGroup 显示子View 行和列中的元素。

    启动名为APP的新项目。

    打开Resources/Layout/main.axml文件,并插入以下内容:

    <?xml version="1.0" encoding="utf-8"?>
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:stretchColumns="1">
     
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:layout_column="1"
                android:text="Open..."
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
            <TextView
                android:text="Ctrl-O"
                android:gravity="right"
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </TableRow>
     
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:layout_column="1"
                android:text="Save..."
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
            <TextView
                android:text="Ctrl-S"
                android:gravity="right"
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </TableRow>
     
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:layout_column="1"
                android:text="Save As..."
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
            <TextView
                android:text="Ctrl-Shift-S"
                android:gravity="right"
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </TableRow>
     
        <View
            android:layout_height="2dip"
            android:background="#FF909090"
            android:layout_width="match_parent" />
     
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:text="X"
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
            <TextView
                android:text="Import..."
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </TableRow>
     
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:text="X"
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
            <TextView
                android:text="Export..."
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
            <TextView
                android:text="Ctrl-E"
                android:gravity="right"
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </TableRow>
     
        <View
            android:layout_height="2dip"
            android:background="#FF909090"
            android:layout_width="match_parent" />
     
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:layout_column="1"
                android:text="Quit"
                android:padding="3dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </TableRow>
    </TableLayout>

    请注意,这与 HTML 表的结构类似。 TableLayout 元素类似于 HTML <table> 元素;TableRow 与 <tr> 元素类似;但对于单元,可以使用任何类型的View元素。 在此示例中, TextView 用于每个单元格。 在某些行之间,还有一个用于绘制水平线的基本View

    请确保APP活动会在OnCreate()中加载此布局。

    SetContentView (Resource.Layout.Main);
    运行该应用程序。 应该会看到以下内容
     
     
     
  • 相关阅读:
    【JS】修改字体
    【git】.gitignore文件常用设置
    【CSS】让textarea在div里水平垂直都居中的三种办法
    【JS】随着进度条进展,逐个显示li节点
    【MySQL】The server time zone value 'xxxxxx' is unrecognized or represents more than one time zone 解决方案
    浅谈Web前端开发中的Touch事件
    [转]PostgreSQL与MySQL比较
    RDLC:An error occurred during local report processing
    [转]让你的PHP更安全
    [转]Win7或Windows server 2008中IIS7支持ASP+Access解决方法
  • 原文地址:https://www.cnblogs.com/Chestnut-g/p/14173797.html
Copyright © 2011-2022 走看看