每日总结2023/2/25

今天继续进行安卓学习

 

 

 

 

 

 

 

 

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <Toolbar
        android:id="@+id/tb"
        android:background="@color/colorAccent"
        android:navigationIcon="@drawable/ic_launcher_background"
        android:title="标题"
        android:layout_width="wrap_content"
        android:layout_height="?attr/actionBarSize"
        android:titleTextColor="@color/colorPrimary"
        android:titleMarginStart="50dp"
        android:subtitle="子标题"
        android:subtitleTextColor="@color/colordu"
        android:logo="@mipmap/ic_launcher"
        />
    <Toolbar
        android:id="@+id/tb2"
      android:layout_marginTop="10dp"
        android:background="@color/colorAccent"
        android:navigationIcon="@drawable/ic_launcher_background"
        android:title="标题"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:titleTextColor="@color/colorPrimary"
        android:titleMarginStart="50dp"
        android:subtitle="子标题"
        android:subtitleTextColor="@color/colordu"
        android:logo="@mipmap/ic_launcher"
        tools:ignore="NewApi"/>
    <Toolbar
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:layout_marginTop="10dp"
 
        android:background="@color/colorPrimary"
        android:navigationIcon="@drawable/ic_launcher_background"
 
 
        tools:ignore="NewApi">
 
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:text="标题" />
    </Toolbar>
 
 
 
 
     
     
     
</LinearLayout>

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.example.a86191.mytoolbar;
 
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toolbar;
 
public class MainActivity extends AppCompatActivity {
  public static final String TAG="MainActivity";
    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar=findViewById(R.id.tb);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Log.e(TAG, "onClick: toolbar被点击了");
            }
        });
        Toolbar toolbar2=findViewById(R.id.tb2);
        toolbar2.setNavigationIcon(R.drawable.ic_launcher_foreground);
        toolbar2.setTitle("标题");
        toolbar2.setNavigationOnClickListener(new View.OnClickListener(){
 
 
            @Override
            public void onClick(View view) {
                Log.e(TAG, "onClick: toolbar2被点击了");
            }
        });
    }
}

  

posted @   橘子味芬达水  阅读(5)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示