我的应用程序上有一个自定义操作栏,但该位置不适合屏幕。由于我无法解决这个错误,因此操作栏移动了一点,这真的很烦人。我的 styles.xml 有什么用?
任何提示和解决方案都将非常感激。
styles.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="PhotosGridView">
<item name="android:horizontalSpacing">1dp</item>
<item name="android:numColumns">auto_fit</item>
<item name="android:stretchMode">columnWidth</item>
<item name="android:verticalSpacing">1dp</item>
</style>
<style name="PhotoGridLayout">
<item name="android:drawSelectorOnTop">true</item>
<item name="android:listSelector">@drawable/photogrid_list_selector</item>
</style>
<style name="ThemeForHome" parent="Theme.AppCompat">
<item name="homeAsUpIndicator">@drawable/menu_icon</item>
</style>
<style name="GeneralLabelFont">
<item name="android:textSize">15sp</item>
<item name="android:textColor">@android:color/black</item>
</style>
<style name="LoginLabelFont" parent="GeneralLabelFont">
<item name="android:textColor">@color/light_blue</item>
</style>
<style name="SubscriptionLabelFont" parent="GeneralLabelFont">
<item name="android:textColor">@color/white</item>
</style>
<style name="LoginDialogListItemPaddings">
<item name="android:paddingBottom">5dp</item>
<item name="android:paddingLeft">10dp</item>
<item name="android:paddingRight">5dp</item>
<item name="android:paddingTop">5dp</item>
</style>
<style name="Theme.Transparent" parent="AppTheme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
<item name="android:windowBackground">@color/transparent_black</item>
<item name="android:colorForeground">#fff</item>
</style>
答案 0 :(得分:0)
我在我的应用中遇到了类似的问题。这就是我设置自定义ActionBar的方法:
final ViewGroup actionBarLayout = (ViewGroup) getLayoutInflater().inflate(
R.layout.your_custom_action_bar_layout,
null);
final ActionBar actionBar = getActionBar();
以下是我设置的参数:
actionBar.setHomeButtonEnabled(false);
actionBar.setDisplayShowHomeEnabled(false); // This line removes the space
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(actionBarLayout);