【发布时间】:2018-07-16 01:51:33
【问题描述】:
我想在操作栏的中心显示徽标。这是我的布局代码:下面的代码应该可以工作,但为什么没有?请帮帮我
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo"
android:layout_gravity="center"
/>
</LinearLayout>
并且在 onCreate()
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setCustomView(R.layout.custom_logo);
【问题讨论】:
-
我试过这个链接,但它对我不起作用
-
我的标志没有居中
-
添加您获得和想要的屏幕截图
-
我只想将我的徽标放在操作栏的中心。我尝试了所有代码,但我不明白为什么不在工具栏的中心
标签: android android-actionbar position toolbar