Toolbar属性简介

styles.xml代码:

version="1.0" encoding="utf-8"?>


    
  --toobar中title字体大下设置  -->  
 

widget_layout.xml代码:


   
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    **xmlns:app="http://schemas.android.com/apk/res-auto"**
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimary"
    android:minHeight="?android:attr/actionBarSize"
    android:theme="@style/ToolbarTheme"

    **app:titleTextAppearance="@style/toolbarTitleSize"**>

android.support.v7.widget.Toolbar>

MainActivity.java 代码:

public class MainActivity extends AppCompatActivity {
    Toolbar toolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setTheme(R.style.NightTheme);

//        changeLanguage(this, 1);
        setContentView(R.layout.layout);
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
    }

Toolbar属性简介_第1张图片

你可能感兴趣的:(Toolbar属性简介)