学习记录(3.22)
学习时长:6h
代码行数:约200行
今天上午继续学习网络传输的相应知识,之后学习毛概,为考研课打下了相应的基础。
下午制作了安卓的基础页面,并且跟同伴进行了页面布置的构思。
晚上跟乐队成员一起进行编曲,把《way back home》进行了放克化简单改编,到时候在音乐节上演出。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/btn_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="查询地铁线路"/>
<Button
android:id="@+id/btn_station"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="查询地铁站"/>
<Button
android:id="@+id/btn_chaxun"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="查询地铁路径"/>
</LinearLayout>
</LinearLayout>
package com.example.subway;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Menu extends AppCompatActivity implements View.OnClickListener {
private Button line1;
private Button line2;
private Button line3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
line1 = findViewById(R.id.btn_line);
line1.setOnClickListener(this);
line2 = findViewById(R.id.btn_station);
line2.setOnClickListener(this);
line3 = findViewById(R.id.btn_chaxun);
line3.setOnClickListener(this);
}
@Override
public void onClick(View view) {
Intent intent = new Intent();
switch (view.getId()){
case R.id.btn_line:
intent.setClass(Menu.this, Line.class);
startActivity(intent);
break;
case R.id.btn_station:
intent.setClass(Menu.this, Station.class);
startActivity(intent);
break;
case R.id.btn_chaxun:
intent.setClass(Menu.this, StartEnd.class);
startActivity(intent);
break;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="欢迎使用地铁查询系统"
android:textSize="40dp"/>
<Button
android:id="@+id/btn_kaishi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="进入系统"
android:background="@color/teal_200"/>
</LinearLayout>
package com.example.subway;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = findViewById(R.id.btn_kaishi);
button.setOnClickListener(this);
}
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setClass(MainActivity.this,Menu.class);
startActivity(intent);
}
}



浙公网安备 33010602011771号