Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了版本控制 – 我的工具栏未在API级别19(Kitkat)上显示,而它显示为API级别21大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的代码没有显示Kitkat上的工具栏.
这是我的两个 Android版本的ScreenShot.

Kitkat版本:

棒棒糖版:

这可能是背后的原因.

清单文件

@H_197_16@<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://scheR_300_11845@as.android.com/apk/res/android" package="com.global.market"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <application android:allowBACkup="true" android:icon="@mipmap/image_front" android:label="@String/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:label="@String/app_name" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".detailactivity" android:label="@String/app_name" /> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> <Meta-data android:name="com.google.android.gms.version" android:value="6111000" /> </application> </manifest>

Styles.xml文件

@H_197_16@<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> <item name="windowActionBarOverlay">false</item> <item name="windowNo@R_696_10283@e">true</item> <item name="windowActionBar">false</item> </style> <style name="AppTheme.NoActionBar"> <item name="colorPriMary">@color/colorPriMary</item> <item name="colorPriMaryDark">@color/colorPriMaryDark</item> <item name="colOraccent">@color/colOraccent</item> <item name="windowActionBar">false</item> <item name="windowNo@R_696_10283@e">true</item> </style> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

activity_main.xml中

@H_197_16@<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://scheR_300_11845@as.android.com/apk/res/android" xmlns:app="http://scheR_300_11845@as.android.com/apk/res-auto" xmlns:ads="http://scheR_300_11845@as.android.com/apk/res-auto" xmlns:tools="http://scheR_300_11845@as.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:openDrawer="start"> <include layout="@layout/app_bar_main" 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_main" android:clickable="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ExpandableListView android:id="@+id/exp_list" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="160dp" android:inDicatorRight="?android:attr/expandableListPreferredItemInDicatorRight" android:BACkground="@android:color/white" android:footerDividersEnabled="true" android:groupInDicator="@null"> </ExpandableListView> <!--<ListView--> <!--android:BACkground="@android:color/white"--> <!--android:id="@+id/menuList"--> <!--android:layout_width="match_parent"--> <!--android:layout_height="match_parent"--> <!--android:layout_marginTop="10dp" />--> </LinearLayout> </android.support.design.widget.NavigationView> </android.support.v4.widget.DrawerLayout> @H_1000_6@mainActivity.java

@H_197_16@@Override protected void onCreate(Bundle savedInstanceStatE) { super.onCreate(savedInstanceStatE); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } }

Build.gradle文件

@H_197_16@apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.3" ext { supportLibVersion = '23.4.0' // variable that can be referenced to keep support libs consistent } defaultConfig { applicationId "com.global.market" minSdkVersion 14 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs',include: ['*.jar']) TESTCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.4.0' compile 'com.loopj.android:android-async-http:1.4.9' compile 'com.android.support:cardview-v7:23.0.+' compile 'com.android.support:recyclerview-v7:23.0.+' compile 'com.google.code.gson:gson:2.6.2' compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.retrofit2:converter-gson:2.1.0' compile 'com.github.gabrielemariotti.cards:cardslib-core:2.1.0' compile 'com.github.gabrielemariotti.cards:cardslib-cards:2.1.0' compile 'com.github.PhilJay:MPAndroidChart:v2.2.4' compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar') compile 'com.google.android.gms:play-services:6.1.11' }

解决方法

认情况下,AppBar具有在棒棒糖之后工作的高程.因此,尽管布局层次结构,它始终可见.但是在较低版本(在棒棒糖下面),工具栏可能会在其他布局下方绘制.

因此,请重新排列布局项以使工具栏可见.

大佬总结

以上是大佬教程为你收集整理的版本控制 – 我的工具栏未在API级别19(Kitkat)上显示,而它显示为API级别21全部内容,希望文章能够帮你解决版本控制 – 我的工具栏未在API级别19(Kitkat)上显示,而它显示为API级别21所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。