|
8 | 8 |
|
9 | 9 | import android.view.View; |
10 | 10 |
|
| 11 | +import androidx.appcompat.widget.Toolbar; |
11 | 12 | import androidx.navigation.NavController; |
12 | 13 | import androidx.navigation.Navigation; |
13 | 14 | import androidx.navigation.ui.AppBarConfiguration; |
14 | 15 | import androidx.navigation.ui.NavigationUI; |
15 | | -import asia.remix.myfragment.databinding.ActivityMainBinding; |
16 | 16 |
|
17 | 17 | import android.view.Menu; |
18 | 18 | import android.view.MenuItem; |
19 | 19 |
|
| 20 | +import com.google.android.material.floatingactionbutton.FloatingActionButton; |
| 21 | + |
20 | 22 | public class MainActivity extends AppCompatActivity{ |
21 | 23 |
|
22 | 24 | private AppBarConfiguration appBarConfiguration; |
23 | | - private ActivityMainBinding binding; |
24 | 25 |
|
25 | 26 | @Override |
26 | 27 | protected void onCreate( Bundle savedInstanceState ){ |
27 | 28 | super.onCreate( savedInstanceState ); |
28 | 29 |
|
29 | | - binding = ActivityMainBinding.inflate( getLayoutInflater() ); |
30 | | - setContentView( binding.getRoot() ); |
31 | | - |
32 | | - setSupportActionBar( binding.toolbar ); |
| 30 | + setContentView( R.layout.activity_main ); |
| 31 | + Toolbar toolbar = findViewById( R.id.toolbar ); |
| 32 | + setSupportActionBar( toolbar ); |
33 | 33 |
|
34 | 34 | NavController navController = Navigation.findNavController( this, R.id.nav_host_fragment_content_main ); |
35 | 35 | appBarConfiguration = new AppBarConfiguration.Builder( navController.getGraph() ).build(); |
36 | 36 | NavigationUI.setupActionBarWithNavController( this, navController, appBarConfiguration ); |
37 | 37 |
|
38 | | - binding.fab.setOnClickListener( new View.OnClickListener(){ |
| 38 | + FloatingActionButton fab = findViewById( R.id.fab ); |
| 39 | + fab.setOnClickListener( new View.OnClickListener(){ |
39 | 40 | @Override |
40 | 41 | public void onClick( View view ){ |
41 | 42 | Snackbar.make( view, "Replace with your own action", Snackbar.LENGTH_LONG ).setAction( "Action", null ).show(); |
|
0 commit comments