• Android学习笔记——MixLayout


    该工程的功能是实现LinearLayout+TableLayout

    以下代码是MainActivity.java中的代码

    package com.example.mixlayout;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.widget.TextView;
    
    public class MainActivity extends Activity {
    
        private TextView firstText; 
        
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }
    }

    以下代码是activity_main.xml中的代码

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/LinearLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        tools:context="${relativePackage}.${activityClass}" >
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:orientation="horizontal" >
    
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:background="#aa0000"
                android:gravity="center_horizontal"
                android:text="red" />
    
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:background="#00aa00"
                android:gravity="center_horizontal"
                android:text="green" />
    
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:background="#0000aa"
                android:gravity="center_horizontal"
                android:text="blue" />
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:orientation="horizontal" >
    
            <TableLayout 
                xmlns:android="http://schemas.android.com/apk/res/android" 
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:stretchColumns="1">
                <TableRow>
    
                    <TextView
                        android:padding="3dip"
                        android:text="row1_column1" />
    
                    <TextView
                        android:gravity="center_horizontal"
                        android:padding="3dip"
                        android:text="row1_column2" />
    
                    <TextView
                        android:gravity="right"
                        android:padding="3dip"
                        android:text="row1_column3" />
                </TableRow>
    
                <TableRow>
    
                    <TextView
                        android:padding="3dip"
                        android:text="row2_column1" />
    
                    <TextView
                        android:gravity="center_horizontal"
                        android:padding="3dip"
                        android:text="row2_column2" />
    
                    <TextView
                        android:gravity="right"
                        android:padding="3dip"
                        android:text="row2_column3" />
                </TableRow>
            </TableLayout>
        </LinearLayout>
    
    </LinearLayout>
  • 相关阅读:
    【Oracle 12c】最新CUUG OCP-071考试题库(58题)
    【Oracle 12c】最新CUUG OCP-071考试题库(57题)
    【Oracle 12c】最新CUUG OCP-071考试题库(56题)
    【Oracle 12c】最新CUUG OCP-071考试题库(55题)
    voip,
    处理xmpp 离线信息,
    流程,xmpp发送信息,
    折腾我几天的 消息状态,
    三者的区别,
    bundle,
  • 原文地址:https://www.cnblogs.com/tonglin0325/p/4584170.html
Copyright © 2020-2023  润新知