展会信息港展会大全

如何令navigation bar的标题居中? 如何使用自定义的navigati...
来源:互联网   发布日期:2016-01-14 11:35:39   浏览:3501次  

导读:public ActionBar setUpActionBar() { ActionBar actionBar = getActionBar(); ActionBar.LayoutParams params = new ActionBar.LayoutParams( ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER); View viewActio...

public ActionBar setUpActionBar() {

ActionBar actionBar = getActionBar();

ActionBar.LayoutParams params = new ActionBar.LayoutParams(

ActionBar.LayoutParams.WRAP_CONTENT,

ActionBar.LayoutParams.MATCH_PARENT,

Gravity.CENTER);

View viewActionBar = getLayoutInflater().inflate(R.layout.action_bar_menu, null);

actionBar.setCustomView(viewActionBar, params);

actionBar.setDisplayShowCustomEnabled(true);

actionBar.setHomeButtonEnabled(true);

actionBar.setIcon(R.drawable.dash);

return actionBar;

}

<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:orientation="horizontal" >

<TextView

android:id="@+id/abs__action_bar_title"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="center"

android:maxLines="1"

android:clickable="false"

android:focusable="false"

android:longClickable="false"

android:textStyle="bold"

android:textSize="18sp"

android:textColor="#FFFFFF" />

</LinearLayout>

赞助本站

人工智能实验室

相关热词: android开发 android教程

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港