标签: android-appcompat

如何使用DrawerLayout在ActionBar /工具栏上和状态栏下显示?

我在新的材料设计Side Nav规范中看到,您可以在操作栏上和状态栏后面显示抽屉.我该如何实现呢?

android android-appcompat navigation-drawer

391
推荐指数
5
解决办法
21万
查看次数

升级到AppCompat v22.1.0并且现在获得IllegalArgumentException:AppCompat不支持当前主题功能

我刚刚升级了我的应用程序以使用新发布的v22.1.0 AppCompat,当我打开我的应用程序时,我现在收到以下异常.

Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features
        at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:360)
        at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:246)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
Run Code Online (Sandbox Code Playgroud)

我如何解决它?

android android-appcompat

333
推荐指数
3
解决办法
6万
查看次数

AppCompat v7 r21在values.xml中返回错误?

我正在使用Android Studio,当我添加compile "com.android.support:appcompat-v7:21.0.0" 到Gradle文件时,我遇到了大量错误:

C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v11\values.xml
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v14\values.xml
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, …
Run Code Online (Sandbox Code Playgroud)

android android-appcompat android-studio

280
推荐指数
5
解决办法
29万
查看次数

为什么Eclipse在创建新项目时会自动添加appcompat v7库支持?

为什么Eclipse appcompat v7在创建新项目时会自动添加库支持?

我正在创建一个MainActivity应该扩展的简单项目Activity,但事实并非如此.Eclipse自动添加操作栏支持.

如何在没有appcompat库的情况下创建一个简单的项目?仅供参考,我已经下载了最新版本的ADT,最近更新了所有内容.我使用的是Window 7 x64.

在此输入图像描述

eclipse android android-appcompat

216
推荐指数
5
解决办法
15万
查看次数

找不到与给定名称匹配的资源:attr'android:keyboardNavigationCluster'.更新到支持库26.0.0时

我在更新到最新的支持库版本26.0.0时遇到此问题(https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0):

错误:(18,21)找不到与给定名称匹配的资源:attr'android:keyboardNavigationCluster'.

/.../app/build/intermediates/res/merged/beta/debug/values-v26/values-v26.xml
Error:(15, 21) No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
Error:(18, 21) No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
Error:(15, 21) No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
Error:(18, 21) No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
Error:Execution failed for task ':app:processBetaDebugResources'.
Run Code Online (Sandbox Code Playgroud)

com.android.ide.common.process.ProcessException:无法执行aapt

该文件来自支持库:

<style name="Base.V26.Widget.AppCompat.Toolbar" parent="Base.V7.Widget.AppCompat.Toolbar">
    <item name="android:touchscreenBlocksFocus">true</item>
    <item name="android:keyboardNavigationCluster">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我们使用以下版本:

ext.COMPILE_SDK_VERSION = 26
ext.BUILD_TOOLS_VERSION = "26.0.1"

ext.MIN_SDK_VERSION = 17
ext.TARGET_SDK_VERSION = …
Run Code Online (Sandbox Code Playgroud)

android android-appcompat android-support-library android-gradle-plugin

213
推荐指数
10
解决办法
14万
查看次数

无法解析符号'AppCompatActivity'

我刚刚尝试使用Android Studio.我创建了空白项目并试图创建Activity扩展AppCompatActivity.不幸的Android Studio"说"它

无法解析符号'AppCompatActivity'

我有 compile "com.android.support:appcompat-v7:22.0.+"我的"app"模块的依赖列表和重建项目几次.但是我只能使用ActionBarActivity.我究竟做错了什么?

android android-appcompat gradle android-support-library android-studio

204
推荐指数
15
解决办法
27万
查看次数

在平板电脑设备上没有占据全宽的标签[使用android.support.design.widget.TabLayout]

我有设置标签作为UPDATE 29/05/2015 这篇文章.标签在我的Nexus 4手机上占据全宽,但在nexus 7平板电脑上占据中心位置而不是覆盖全屏宽度.

Nexus 7截图 Nexus7 Nexus 4截图 Nexus 4

tabs android width android-appcompat android-tablayout

186
推荐指数
6
解决办法
8万
查看次数

使用AppCompat-v7的工具栏和上下文ActionBar

我正在使用Lollipop和AppCompat-v7库中引入的新添加的工具栏.我按照本指南设置了工具栏我注意到当你调用一些会调出上下文ActionBar的内容(例如突出显示复制/粘贴的文本)时,它会将工具栏向下推到页面上.您可以在页面底部的图像中看到我在说什么:

所以,基本上,我这样设置它.我在xml文件中定义了工具栏,我使用包含标签:

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimary"/>
Run Code Online (Sandbox Code Playgroud)

然后,我在我的视图中实例化它:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/root"
    tools:context=".MainActivity">

    <include
        layout="@layout/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/> 

    <!-- Rest of view -->

    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

在代码中,我这样设置:

    // On Create method of activity:
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
Run Code Online (Sandbox Code Playgroud)

有没有人知道怎么做才能让Contextual ActionBar超越工具栏?

工具栏和上下文ActionBar

android android-appcompat android-5.0-lollipop android-toolbar

179
推荐指数
5
解决办法
6万
查看次数

无法在styles.xml(Android Studio)中解析符号'Theme'

截图

从今天开始,Android Studio无法在styles.xml中找到AppCompat主题,但是例如代码中的AppCompatActivity确实得到了识别.我的Android Studio版本是2.2.2,Build#AI-145.3360264

我已经尝试升级到最新的构建工具,编译sdk(25)版本等,但它没有解决问题.

目前我安装了以下内容(来自sdk经理):

  • android api:19和23
  • sdk平台工具:25.0.1
  • sdk工具:25.2.3
  • 构建工具:23.0.2和25.0.1
  • 支持存储库:40
  • 谷歌存储库:39

和其他一些,这里没有必要列出.

app的build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.1'
    defaultConfig {
        applicationId "xxx.xxxxxxxx.xxxxxxxxx" //not the real applicationId
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {

        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/RootTools.jar')
    compile 'com.android.support:support-v4:23.+'
    compile 'com.android.support:support-v13:23.+'
    compile 'com.android.support:appcompat-v7:23.+'
    compile 'com.android.support:design:23.+'
    compile 'com.android.support:cardview-v7:23.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4' …
Run Code Online (Sandbox Code Playgroud)

android android-appcompat gradle android-studio android-styles

175
推荐指数
10
解决办法
7万
查看次数

使用RecyclerView + AppBarLayout

我正在使用新的CoordinatorLayout与AppBarLayout和CollapsingToolbarLayout.在AppBarLayout下面,我有一个带有内容列表的RecyclerView.

我已经验证了当我在列表中上下滚动时,滚动滚动在RecyclerView上工作.但是,我还希望AppBarLayout在扩展期间顺利滚动.

向上滚动以展开CollaspingToolbarLayout时,一旦将手指从屏幕上抬起,滚动会立即停止.如果向上快速向上滚动,有时CollapsingToolbarLayout也会重新折叠.与使用NestedScrollView时,RecyclerView的这种行为似乎有很大不同.

我试图在recyclerview上设置不同的滚动属性,但我无法弄清楚这一点.

这是一个显示一些滚动问题的视频. https://youtu.be/xMLKoJOsTAM

这是一个显示RecyclerView(CheeseDetailActivity)问题的示例. https://github.com/tylerjroach/cheesesquare

以下是使用Chris Banes的NestedScrollView的原始示例. https://github.com/chrisbanes/cheesesquare

android android-appcompat android-layout android-design-library

171
推荐指数
5
解决办法
5万
查看次数