仅显示操作栏的下半部分(并且它位于状态栏后面)

时间:2015-12-23 14:15:09

标签: android android-actionbar

出于某种原因,仅显示DrawerActivity的下半部分,显示的一半在状态栏后面。为什么会这样? 这只发生在Activity

它必须是新版Android的东西,因为我注意到了Android 5.0.2和6.0中的错误。在Android 4.4.4中没有问题。

我从android.support.v7.app.AppCompatActivity扩展我的android { compileSdkVersion 22 buildToolsVersion "21.1.2" defaultConfig { applicationId "com.mypackage.myapp" minSdkVersion 15 targetSdkVersion 22 versionCode 1 versionName "1.0" } 并在其中实现一些片段。

这是我的应用配置:

DrawerActivity

<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="false" tools:openDrawer="start"> <include layout="@layout/app_bar_drawer" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:fitsSystemWindows="true" app:headerLayout="@layout/nav_header_drawer" app:menu="@menu/activity_drawer_drawer" /> </android.support.v4.widget.DrawerLayout>

的布局
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>

styles.xml:

onCreate
DrawerActivity

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_drawer); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); //Setting floating button FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); //Setting up default fragment. Fragment fragment = HomeFragment.newInstance(null, null); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.mainFrame, fragment); ft.commit(); } 方法:

var logoUploader = $(".ruFileInput");

以下是更好理解的屏幕截图:

Action bar behind the status bar

谢谢!

1 个答案:

答案 0 :(得分:0)

在你的oncreate中添加这一行

myvar <- "/'ode acs er cart/'"
web<-remDr$findElement(using = 'xpath', "//*/li[@class=myvar]")