想多学习,想多了解。
不然,关于IT的整个链条就串不起来~
到了安卓开发这里了,
感觉蛮有意思~~~
书是按照台湾旗标公司的《Android APP开发入门》一步一步学习。
这个公司的书,不错。
大约记得2000年,我学DREAMWEARE时,也买过这家公司的一本书,
周到细致,如保姆一样亲手指导,学得毫无压力~~:)
主代码:
package com.tw.flag.ch02_button;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
EditText sname, fname, phone;
TextView txv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
sname = (EditText) findViewById(R.id.surName);
fname = (EditText) findViewById(R.id.firstName);
phone = (EditText) findViewById(R.id.phone);
txv = (TextView) findViewById(R.id.txv);
}
public void onclick(View v) {
txv.setText(sname.getText().toString() +
fname.getText() +
"的电话是 " + phone.getText());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}