android-appcompat

Android v21 Theme.Appcompat color accent is ignored, no padding on dialogs

北慕城南 提交于 2019-12-17 08:23:28
问题 I'm using ActionBarActivity from the Android 5 SDK and here is my theme.xml for v21 <style name="AppTheme_Light" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:colorPrimary">@color/abc1</item> <item name="android:colorPrimaryDark">@color/abc2</item> <item name="android:colorAccent">@color/abc3</item> </style> But the colors are ignored, and are replaced by a default teal color and all the dialogs appear without padding. Also, padding is also ignored in other places like

Android 5.0: how to change recent apps title color?

為{幸葍}努か 提交于 2019-12-17 07:13:19
问题 I'm using AppCompat and my theme is extending Theme.AppCompat.Light.DarkActionBar . When in Android 5 Lollipop and I press the recent apps button, my app appears with a dark title instead of a white title in the ActionBar. When I'm inside the app everything looks fine. What can I do to change the title color in the recent apps view? EDIT : just figured out that if I use a darker colorPrimary , the title becomes white. I still need a way to force the white title with the original color. 回答1:

How to change Toolbar Navigation and Overflow Menu icons (appcompat v7)?

旧时模样 提交于 2019-12-17 07:09:49
问题 I am having a hard time with v7 Toolbar. What was once a simple task for ActionBar , now seems overly complex. No matter what style I set, I cannot change either navigation icon (which opens a Drawer) or overflow menu icon (which opens a menu). So I have a Toolbar <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android

Cannot resolve symbol 'Theme' in styles.xml (Android Studio)

﹥>﹥吖頭↗ 提交于 2019-12-17 04:46:49
问题 Since today, Android Studio can't find the AppCompat themes in styles.xml, but for example AppCompatActivity in code does get recognized. My Android Studio version is 2.2.2, Build #AI-145.3360264 I already tried upgrading to the latest build tools, compile sdk (25) version etc. but it didn't fix the problem. At the moment I have installed the following (from sdk manager): android api: 19 and 23 sdk platform tools: 25.0.1 sdk tools: 25.2.3 build-tools: 23.0.2 and 25.0.1 support repository: 40

How to implement the Material-design Elevation for Pre-lollipop

折月煮酒 提交于 2019-12-17 04:46:08
问题 Google has shown some nice ways that elevation effect are shown on Lollipop here. android:elevation="2dp" for buttons, android:stateListAnimator="@anim/button_state_list_animator" How can I mimic the elevation effect on pre-Lollipop versions without 3rd party library? 回答1: You can mimic the elevation on pre-Lollipop with a official method. I achieve same effect using, android:background="@android:drawable/dialog_holo_light_frame" My tested output: reference - https://stackoverflow.com/a

You need to use a Theme.AppCompat theme (or descendant) with this activity. Change to Theme.AppCompat causes other error

回眸只為那壹抹淺笑 提交于 2019-12-17 04:27:42
问题 I use appcompat v22.1.0 in my App and use Toolbar. Everything was fine when I use Theme.AppCompat.Light.NoActionBar . When I start implement AlertDialog , it produce error like this: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:113) at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146) at android

getActionBar() returns Null (AppCompat-v7 21)

寵の児 提交于 2019-12-17 04:06:08
问题 My app is crashing the minute I run it after I changed my AppCompat-v7 to 21.0.0 and Compiled with no problem. It gives me the error: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setIcon(int)' on a null object reference on this line: getActionBar().setIcon(R.drawable.ic_action_bar); It works with AppCompat-v7 20.0.0, but not with 21.0.0. 回答1: You need to call getSupportActionBar() on an ActionBarActivity. Do not call getActionBar() -- that is

show icon in actionbar/toolbar with AppCompat-v7 21

旧城冷巷雨未停 提交于 2019-12-17 03:48:23
问题 I tried these - but still do not see the icon like before: getSupportActionBar().setLogo(R.drawable.ic_launcher); getSupportActionBar().setDisplayUseLogoEnabled(true); getSupportActionBar().setIcon(R.drawable.ic_launcher); It seems to work when I use custom toolbar - but that would force me to touch all layouts - is there a better way to do so? 回答1: getSupportActionBar().setDisplayShowHomeEnabled(true); along with getSupportActionBar().setIcon(R.drawable.ic_launcher); 回答2: In modern Android

Toolbar and Contextual ActionBar with AppCompat-v7

岁酱吖の 提交于 2019-12-17 03:21:25
问题 I am working on using the newly added Toolbar that was introduced in Lollipop and the AppCompat-v7 library. I followed this guide on setting up the Toolbar I noticed that when you invoke something that will bring up the contextual ActionBar (such as highlighting text for copy/pasting), that it will push the Toolbar down on the page. You can see what I am talking about in the image at the bottom of the page: So, essentially, I set it up like this. I have the Toolbar defined in an xml file that

failed to resolve com.android.support:appcompat-v7:22 and com.android.support:recyclerview-v7:21.1.2

与世无争的帅哥 提交于 2019-12-17 03:01:05
问题 I installed ALL Extra and SDK API 21-22 including changed compileSdkVersion 22 to 21 buildToolsVersion '22.0.1' to 21.1.2 but error. And Rendering Problems for API 22 and I changed to <= 21 it still. 回答1: These are the correct version that you can add in your build.gradle according to the API needs. API 24: implementation 'com.android.support:appcompat-v7:24.2.1' implementation 'com.android.support:recyclerview-v7:24.2.1' API 25: implementation 'com.android.support:appcompat-v7:25.4.0'