Ahm*_*ani 0 android android-actionbar
我想在操作栏上显示徽标,我在清单中使用以下代码:
<activity
android:name=".CompanyActivity"
android:icon="@drawable/ic_launcher"
android:logo="@drawable/ic_launcher"
android:label="@string/title"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar" >
</activity>
Run Code Online (Sandbox Code Playgroud)
并在活动的onCreate方法中同时使用以下两个Java代码:
getSupportActionBar().setIcon(R.drawable.ic_launcher);
Run Code Online (Sandbox Code Playgroud)
和
ActionBar ab = getSupportActionBar();
ab.setLogo(R.drawable.ic_launcher);
Run Code Online (Sandbox Code Playgroud)
但徽标未显示在操作栏中。我能做什么?tnx很多
棒棒糖默认情况下不显示徽标,因此请进行以下设置:
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.drawable.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4209 次 |
| 最近记录: |