package com.example.wang.application1;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class MainActivity
extends AppCompatActivity {
//回调方法,以on开头的方法
//在创建时自动调用
@Override
protected void onCreate(Bundle savedInstanceState) {
//调用父类的回调方法
super.onCreate(savedInstanceState);
//设置内容视图文件
//建立Activity和layout文件之间的关联
setContentView(R.layout.lianxi_linearlayout);
//1.获得这个组件
//Button bt2=(Button)findViewById(R.id.button2);
//2.操作这个组件
//bt2.setText("新按钮");
//日志输出
// System.out.println("日志输出=应用开始运行");
// Log.v("example.wang", "verbose级别的日志信息");
// Log.d("example.wang", "Debug级别的日志信息");
// Log.i("example.wang", "Info级别的日志信息");
// Log.w("example.wang", "Waining级别的日志信息");
// Log.e("example.wang", "Error级别的日志信息");
}
}
Java部分
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="0dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="To" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Subject"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Message"
android:layout_weight="1"
android:gravity="top" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Reset"
android:layout_weight="1"
android:textAllCaps="false"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/app_name1"
android:layout_weight="1"
android:textAllCaps="false"/>
</LinearLayout>
</LinearLayout>
xml部分
转载于:https://www.cnblogs.com/wangchuanqi/p/5401515.html
相关资源:数据结构—成绩单生成器
转载请注明原文地址: https://mac.8miu.com/read-16011.html