Android第一、二周作业

环境截图

 

hello teacher截图

 

 

 1 package com.example.myapplication_01;
 2 
 3 import androidx.appcompat.app.AppCompatActivity;
 4 
 5 import android.os.Bundle;
 6 
 7 public class MainActivity extends AppCompatActivity {
 8 
 9     @Override
10     protected void onCreate(Bundle savedInstanceState) {
11         super.onCreate(savedInstanceState);
12         setContentView(R.layout.activity_main);
13     }
14 }

 

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <GridLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:columnCount="3"
        android:rowCount="3">

        <TextView
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:background="#29ADE6"
            android:text="1"></TextView>


        <TextView
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:background="#3138A5"
            android:text="1"></TextView>

        <TextView
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:background="#CF42D1"
            android:text="1"></TextView>

        <TextView
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:background="#3E7988"
            android:text="1"></TextView>

        <TextView android:text="1"
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:background="#7092be"></TextView>

        <TextView
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:background="#8F7EC8"
            android:text="1"></TextView>

        <TextView
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:background="#29ADE6"
            android:text="1"></TextView>

        <TextView
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:background="#3138A5"
            android:text="1"></TextView>

        <TextView
            android:layout_rowWeight="1"
            android:layout_columnWeight="1"
            android:background="#CF42D1"
            android:text="1"></TextView>

    </GridLayout>
</RelativeLayout>

 

 

posted @ 2021-08-16 18:38  计算机1903孙铭泽  阅读(37)  评论(0编辑  收藏  举报