今天上了工程数学的课,工程数学挺难的,听不懂,很多高数线代都忘了,上课听不上,打算周六补救一下,复习复习高数和线代。
今天打了60行代码,学习了学习了安卓开发。
MainActivity.java
1 package com.example.mytoolbar; 2 3 import androidx.appcompat.app.AppCompatActivity; 4 import androidx.appcompat.widget.Toolbar; 5 6 import android.os.Bundle; 7 import android.util.Log; 8 import android.view.View; 9 10 public class MainActivity extends AppCompatActivity { 11 12 @Override 13 protected void onCreate(Bundle savedInstanceState) { 14 super.onCreate(savedInstanceState); 15 setContentView(R.layout.activity_main); 16 Toolbar toolbar = findViewById(R.id.tb1); 17 toolbar.setNavigationOnClickListener(new View.OnClickListener() { 18 @Override 19 public void onClick(View view) { 20 Log.e("leo", "onClick: 被点击" ); 21 22 } 23 }); 24 Toolbar viewById = findViewById(R.id.tb2); 25 viewById.setNavigationIcon(R.drawable.baseline_balance_24); 26 viewById.setTitle("标题"); 27 viewById.setNavigationOnClickListener(new View.OnClickListener() { 28 @Override 29 public void onClick(View view) { 30 Log.e("lei", "onClick: 2" ); 31 } 32 }); 33 } 34 }
1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:orientation="vertical"> 7 <androidx.appcompat.widget.Toolbar 8 android:id="@+id/tb1" 9 android:layout_width="match_parent" 10 android:layout_height="wrap_content" 11 android:background="#ffff00" 12 app:navigationIcon="@drawable/baseline_balance_24" 13 app:title="标题" 14 app:titleTextColor="#ff0000" 15 app:titleMarginStart="90dp" 16 app:subtitle="子标题" 17 app:subtitleTextColor="#00ff00" 18 app:logo="@mipmap/ic_launcher"/> 19 <androidx.appcompat.widget.Toolbar 20 android:id="@+id/tb2" 21 android:layout_width="match_parent" 22 android:layout_height="?attr/actionBarSize" 23 android:background="#ffff00" 24 android:layout_marginTop="10dp" 25 app:logo="@mipmap/ic_launcher"/> 26 </LinearLayout>
今天上传了Github
xinwen web增删改查
kaifalianxi
标签:import,软工,2023,onClick,viewById,2.23,view,void,View From: https://www.cnblogs.com/daitu66/p/17149484.html