我在我的應用中使用導航抽屜活動,並在標題欄上添加了漂亮的標誌。 我想刪除tittle上的應用程序名稱。我嘗試了很多代碼。我不想用刪除導航抽屜活動(主要)和其他所有活動上的應用標籤
Theme.AppCompat.NoActionBar
我在我的應用中使用導航抽屜活動,並在標題欄上添加了漂亮的標誌。 我想刪除tittle上的應用程序名稱。我嘗試了很多代碼。我不想用刪除導航抽屜活動(主要)和其他所有活動上的應用標籤
Theme.AppCompat.NoActionBar
在style.xml
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowEnableSplitTouch">false</item>
<item name="android:splitMotionEvents">false</item>
</style>
在androidmainfest
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
試試吧!
嘗試以下行可能是工作。
getActionBar().setDisplayShowTitleEnabled(false);
或
getSupportActionBar().setDisplayShowTitleEnabled(false);
謝謝你太過分了。 getSupportActionBar()。setDisplayShowTitleEnabled(false); 工作 – Ivan
在AndroidManifest.xml
<activity
android:name=".MainActivity"
android:label=""
android:theme="@style/AppTheme.NoActionBar"
android:configChanges="screenSize|orientation">
</activity>
在styles.xml添加以下代碼
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
非常感謝... –
你使用工具欄? –
你的意思是自定義工具欄? –
是不是有什麼像'getActionBar()。setTitle(「」)'? – MKJParekh