2024/5/2(冲刺第六天)

所学时间:2小时

代码行数:200

博客园数:1篇

所学知识:由于前几天的懈怠,导致第一阶段任务未完成,所以在五一假期进行加班。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">

<TextView
android:id="@+id/textViewTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请选择您的角色"
android:textSize="24sp"
android:textColor="@color/black"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_below="@id/textViewTitle"
android:layout_marginTop="20dp">

<Button
android:id="@+id/btnElderly"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="老人"
android:backgroundTint="@color/input_background"
android:textColor="@color/black"
android:layout_margin="10dp"/>

<Button
android:id="@+id/btnChild"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="子女"
android:backgroundTint="@color/input_background"
android:textColor="@color/black"
android:layout_margin="10dp"/>

<Button
android:id="@+id/btnDoctor"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="医生"
android:backgroundTint="@color/input_background"
android:textColor="@color/black"
android:layout_margin="10dp"/>

</LinearLayout>

</RelativeLayout>
package com.example.kanglaojian;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class role extends AppCompatActivity {
private Button btnElderly;
private Button btnChild;
private Button btnDoctor;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_role);

btnElderly=findViewById(R.id.btnElderly);
btnChild=findViewById(R.id.btnChild);
btnDoctor=findViewById(R.id.btnDoctor);
btnElderly.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(role.this,older_information.class);
startActivity(intent);
}
});
btnChild.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(role.this,Child_information.class);
startActivity(intent);
}
});
btnDoctor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(role.this,Doctor_information.class);
startActivity(intent);
}
});
}
}
posted @ 2024-05-02 16:51  为20岁努力  阅读(1)  评论(0编辑  收藏  举报