我正在尝试找出使用自定义字体作为工具栏标题的正确方法,并将其置于工具栏中(客户端要求).
目前,我正在使用旧的ActionBar,我将标题设置为空值,并使用setCustomView自定义字体TextView并使用ActionBar.LayoutParams将其居中.
有没有更好的方法呢?使用新工具栏作为我的ActionBar.
android android-layout android-theme android-styles android-toolbar
我试图将标题文本集中在一个既有前导又有尾随动作的应用栏中.
@override
Widget build(BuildContext context) {
final menuButton = new PopupMenuButton<int>(
onSelected: (int i) {},
itemBuilder: (BuildContext ctx) {},
child: new Icon(
Icons.dashboard,
),
);
return new Scaffold(
appBar: new AppBar(
// Here we take the value from the MyHomePage object that
// was created by the App.build method, and use it to set
// our appbar title.
title: new Text(widget.title, textAlign: TextAlign.center),
leading: new IconButton(
icon: new Icon(Icons.accessibility),
onPressed: () {},
),
actions: [
menuButton,
],
),
body: new …Run Code Online (Sandbox Code Playgroud) 我第一次在我的项目中使用ToolBar,所以我不知道如何在android中自定义工具栏.我需要将标题集中到工具栏中,如何做到这一点请告诉我.
预先感谢.