该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
package com.example.administrator.a3_01test;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
//private TextView textView;
private EditText editText;
private Button normalButton;
private ImageButton imageButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//textView=(TextView)findViewById(R.id.aid);
//textView.setText("Change in World");
//String str=textView.getText().toString();
/*editText=(EditText)findViewById(R.id.edit);
editText.setText("Change");
String strEditText=editText.getText().toString();*/
super.onCreate(savedInstanceState);
normalButton=(Button)findViewById(R.id.button);
imageButton=(ImageButton)findViewById(R.id.imagebutton);
editText=(EditText)findViewById(R.id.edit);
normalButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editText.setText("普通按钮");
}
});
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editText.setText("图片按钮");
}
});
}
}