我正在尝试创建一个Nav Drawer,就像Material spec中的那个(就像新gmail应用程序中的那个).请注意导航抽屉的内容如何在状态栏后面绘制:
使用Chris Banes从这个问题的答案,我能够成功地使我的应用程序中的导航抽屉在状态栏后面绘制; 这工作正常.什么是无效的是绘制状态栏后面的导航抽屉的内容.我希望抽屉中的蓝色图像显示在状态栏后面,但该区域使用状态栏的颜色绘制,如此屏幕截图所示.
那么,如何在状态栏后面的区域中绘制导航抽屉?我在下面发布了我项目的相关部分.
包含导航抽屉的基本布局:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/warning_container" />
<FrameLayout
android:id="@+id/navigation_drawer_fragment_container"
android:layout_width="300dp"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:layout_gravity="start">
<fragment
android:id="@+id/navigation_drawer_fragment"
android:name="com.thebluealliance.androidclient.fragments.NavigationDrawerFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_navigation_drawer" />
</FrameLayout>
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
我活动的主题
<style name="AppThemeNoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
Run Code Online (Sandbox Code Playgroud)
在onCreate()
我的活动中,我做了以下事情:
mDrawerLayout.setStatusBarBackground(R.color.primary_dark);
Run Code Online (Sandbox Code Playgroud) 在我使用我的Android应用程序时随机点,LogCat充斥着以下5行的几十个重复:
10-26 12:53:30.372 21270-21270 W/Resources? Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f0b00d8}
10-26 12:53:30.372 21270-21270 W/Resources? Converting to string: TypedValue{t=0x1d/d=0xffe51c23 a=2 r=0x7f090047}
10-26 12:53:30.374 21270-21270 W/Resources? Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f0b008a}
10-26 12:53:30.375 21270-21270 W/Resources? Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f0b00d6}
10-26 12:53:30.375 21270-21270 W/Resources? Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f0b00d7}
Run Code Online (Sandbox Code Playgroud)
使用来自这个问题的接受答案的信息,我确定它试图将空值(0x0)解释为布尔值(0x12),这没有任何意义,因为我从不处理空值或布尔值.
日志中的资源ID(r = 0x?)指向两个布局之一中的视图/视图属性,我将在下面包含这些属性.
我引用这些资源ID的代码中唯一的位置是a)使用第一个布局的CursorAdapter,以及b)使用第二个布局的类,我也将在下面包含该代码.
我不确定这是否值得担心.我知道相关性并不意味着因果关系,但是当LogCat充斥着这些日志时,滚动浏览我的应用程序显然很笨拙.
任何有关弄清楚发生了什么的帮助将不胜感激.
布局文件#1:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="72dp"
android:padding="16dp">
<TextView
android:id="@+id/event_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:maxLines="1"
android:text="Title"
android:textSize="16sp"
android:textColor="@color/primary_text_color"/> …
Run Code Online (Sandbox Code Playgroud) Android 5.0框架是否具有Material-styled选项卡?我知道在开发预览中,它们仍然是Holo风格的.我想知道5.0是否已使用材质样式选项卡进行更新; 我目前使用PagerSlidingTabStrip作为我的选项卡,但尚未使用Material设计进行更新.
更具体地说,支持库是否包含材料选项卡的实现?在4.x上运行的Play商店有这些标签,但我不确定这是否是谷歌的自定义实现.
我会写一个头文件,而且它很长.因为它太复杂了,我不想把内部类定义放在根类中.我的意思是如何在不在根类中编写类内部的情况下创建类.
class outer
{
}
class inner
{
}
Run Code Online (Sandbox Code Playgroud)
如果我可以这样使用,我认为头文件会更清晰.
我目前正在制作一个应用程序,需要能够读取和写入通过USB OTG适配器连接的USB闪存驱动器.有没有一种通过标准Java.io.File
API 访问此存储的简单方法?这个应用程序只能在运行Android 4.2.2的带根据的Motorola Xoom上运行.任何建议,将不胜感激.