Jon*_*tto 67 android android-layout android-studio
在我的应用程序中,顶部有溢出菜单的标题栏,但我不需要设置,只有一个屏幕.当我像许多其他问题中描述的那样改变主题时,我得到了旧的2.2主题.我希望现代主题没有顶部的酒吧.
小智 119
转到styles.xml并更改.DarkActionBar为.NoActionBar
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Run Code Online (Sandbox Code Playgroud)
变
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Run Code Online (Sandbox Code Playgroud)
如果颜色与您的应用程序无关,您实际上可以选择
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" />
Run Code Online (Sandbox Code Playgroud)
小智 55
在清单文件中更改:
android:theme="@style/AppTheme" >
android:theme="@style/Theme.AppCompat.NoActionBar"
Run Code Online (Sandbox Code Playgroud)
小智 23
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
Run Code Online (Sandbox Code Playgroud)
在调用onCreate()之前工作时setContentView().
否则它会崩溃
Kam*_*ngh 16
在styles.xml文件中,将DarkActionBar更改为NoActionBar
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
Run Code Online (Sandbox Code Playgroud)
小智 12
检查一下
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
Run Code Online (Sandbox Code Playgroud)
Zit*_*tro 10
转到项目 -> 应用程序 -> 主 -> 资源 -> 值 -> 样式.xml
如果要为每个视图删除它,请更改此行
`<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">`
Run Code Online (Sandbox Code Playgroud)
到
`<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">`
Run Code Online (Sandbox Code Playgroud)
如果您只想为一个视图制作它,您可以在您的清单数据中更改它。转到 Android -> manifests -> AndroidManifest.xml。执行以下操作:
<activity android:name"...">android:theme=""@style/Theme.AppCompat.NoActionBar"
在清单文件中更改为:
android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
Run Code Online (Sandbox Code Playgroud)
这对我来说是values/styles.xml添加项目的:
`<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>`
Run Code Online (Sandbox Code Playgroud)
小智 5
Run Code Online (Sandbox Code Playgroud)<style name="no_title" parent="AppTheme"> <item name="android:windowNoTitle">true</item> <item name="android:windowContentOverlay">@null</item> </style>
您可以更改名称=“---------”
打开 Androidmafest.xm
找到 android:theme="@style/AppTheme" 更改为 android:theme="@style/no_title"
单击菜单栏上的选择主题(MainActivity 附近为绿色)
小智 5
对于像我这样的初学者。照我说的去做。来自你的 Android 项目。
应用程序 -> res -> 值 -> style.xml
替换此代码
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
享受。
小智 5
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().hide();
setContentView(R.layout.activity_main);
Run Code Online (Sandbox Code Playgroud)
只是简单地放在和方法getSupportActionBar().hide();
之间。super.onCreatesetContentView
在清单文件中执行此操作:
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
221261 次 |
| 最近记录: |