Skip to content

Commit addaa12

Browse files
committed
hzuapps#1 hzuapps#30 第一次作业
1 parent 9f5014e commit addaa12

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.example.administrator.myapplication;
2+
3+
import android.os.Bundle;
4+
import android.support.design.widget.FloatingActionButton;
5+
import android.support.design.widget.Snackbar;
6+
import android.support.v7.app.AppCompatActivity;
7+
import android.support.v7.widget.Toolbar;
8+
import android.view.View;
9+
import android.view.Menu;
10+
import android.view.MenuItem;
11+
12+
public class Net1414080903240Activity extends AppCompatActivity {
13+
14+
@Override
15+
protected void onCreate(Bundle savedInstanceState) {
16+
super.onCreate(savedInstanceState);
17+
setContentView(R.layout.activity_main);
18+
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
19+
setSupportActionBar(toolbar);
20+
21+
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
22+
fab.setOnClickListener(new View.OnClickListener() {
23+
@Override
24+
public void onClick(View view) {
25+
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
26+
.setAction("Action", null).show();
27+
}
28+
});
29+
}
30+
31+
@Override
32+
public boolean onCreateOptionsMenu(Menu menu) {
33+
// Inflate the menu; this adds items to the action bar if it is present.
34+
getMenuInflater().inflate(R.menu.menu_main, menu);
35+
return true;
36+
}
37+
38+
@Override
39+
public boolean onOptionsItemSelected(MenuItem item) {
40+
// Handle action bar item clicks here. The action bar will
41+
// automatically handle clicks on the Home/Up button, so long
42+
// as you specify a parent activity in AndroidManifest.xml.
43+
int id = item.getItemId();
44+
45+
//noinspection SimplifiableIfStatement
46+
if (id == R.id.action_settings) {
47+
return true;
48+
}
49+
50+
return super.onOptionsItemSelected(item);
51+
}
52+
}

0 commit comments

Comments
 (0)