android-appcompat

Android Nougat cannot show certain vector files (Resources$NotFoundException)

橙三吉。 提交于 2019-12-20 23:25:17
问题 I have been working on an app that contains a number of vector graphics. Recently I started testing it on Nougat and found it crashing immediately. The logcat shows a Resources$NotFoundException while loading a vector which is reminiscent of all the AppCompat errors in earlier versions of Android with vector graphics. However, it runs fine on KitKat, Lollipop, and Marshmallow. It is only on Nougat that I am getting this error. I have narrowed it down to a certain number of vector files that

How to apply a theme to an Android Toolbar?

拥有回忆 提交于 2019-12-20 19:05:24
问题 I've spent an inordinate amount of time trying to figure out how to apply some simple styling to a Toolbar, but am utterly stumped. Specifically I want to change the colour of the Title and Subtitle and the overflow menu icon (three dots). I can set the text colours successfully in the layout, but not in the Theme, I have no idea why. <android.support.v7.widget.Toolbar theme="@style/Toolbar" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr

AppCompat Actionbar styling

强颜欢笑 提交于 2019-12-20 18:31:19
问题 I'm currently trying to use AppCompat instead of ActionbarSherlock. On Android 4+ devices I don't run into any problems, as the normal Actionbar and Holo theme are used. On lower Android versions however, this weird look happens when using Theme.AppCompat.Light. The Actionbar is white and has a blue line underneath. I was able to fix that by using the Android Action Bar Style Generator from Android Asset Studio to generate a custom theme with a solid Actionbar instead of the transparent one.

Android AppCompat v21 provides SwitchCompat does not provide SwitchCompatPerefrence

大城市里の小女人 提交于 2019-12-20 18:01:24
问题 It seems AppCompat v21 provides SwitchCompat does not provide SwitchCompatPerefrence. I know I can use SwitchPreference but it is not visually identical. On Android 4.x; when I use SwitchCompact from v21 on activity interface, it looks like material switch button, but, because there is no SwitchCompactPreference I have to use SwitchPreference in my pereference view and obviously it has Android 4.0 look. It looks like AppCompact v21 half complete. Am I missing something? 回答1: Here is a code

AppCompat_v7 Toolbar as actionbar not showing 'always' actions from menu, but API Toolbar does

吃可爱长大的小学妹 提交于 2019-12-20 09:11:12
问题 After 2 days of struggling with the new API 21 Toolbar and appCompat_v7, I think I found a bug on it. If you have 2 actions on your menu like this: <item android:id="@+id/action_test" android:showAsAction="always" android:icon="@drawable/ic_launcher" android:title="@string/action_settings"/> <item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_settings"/> and a appCompat toolbar defined like this: <RelativeLayout

Snackbar and other animations stopped working on some Android devices

此生再无相见时 提交于 2019-12-20 08:49:53
问题 I have a very odd issue that I cannot figure out. I was not an issue until recently but I can't seem to revert back to prevent it. Also the other odd thing is it works on some devices and others it does not. The issue is animations. One in particular is snack bar. The snackbar should animate up and down but it is not. it just shows then hides. check video below to see issue. Video of issue Here is the Android code to animate the snackbar in if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE

Why does the XML onClick attribute set an OnClickListener TWICE on AppCompatButtons

ⅰ亾dé卋堺 提交于 2019-12-20 06:25:26
问题 When Android inflates a Button with an onClick XML attribute, it internally sets a DeclaredOnClickListener on that Button which then uses reflection to trigger the actually onClick method in our code. case R.styleable.View_onClick: [...] final String handlerName = a.getString(attr); if (handlerName != null) { setOnClickListener(new DeclaredOnClickListener(this, handlerName)); } break; I noticed that for AppCompatButton s (i.e. normal Buttons in an AppCompatActivity ) the same process gets

Android status bar tints from kitkat to lollipop

偶尔善良 提交于 2019-12-20 05:34:08
问题 I'm trying to implement the nice status bar for my app and have successfully achieved this on kitkat. This is the xml I'm using <?xml version="1.0" encoding="utf-8" ?> <resources> <style name="AppTheme" parent="AppTheme.Base"/> <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="android:windowBackground">@color/colorPrimary</item> <item name=

Changing AlertDialog buttons alignment

邮差的信 提交于 2019-12-20 04:36:08
问题 Been fighting for hours about changing the alignment of the buttons inside AlertDialog (support.v7 one), since they won't align themselves according to the locale view direction, despite the whole app DOES align to left and also the text inside the AlertDialog. (Why would this happen you say? I'm programatically configuring the locale language to be "en" since that's my default app language, even though the system locale might be something else). So like I said, I don't need to touch the

UNable to implement androidx.appcompat.appcompat:1.0.0

前提是你 提交于 2019-12-20 04:16:25
问题 I am an absolute beginner in Android development and trying to build test automation to test mobile apps. After going through weeks of setting up IntelliJ, I am still facing issues and among them is the following. As I am using SDK ver 29, I was told that I should convert all "support" keyword to androidx's format as per below: SO, when I applied it, I am having the red sqiuggly line indicating error at the end of the "1.0.0" as shown below The following is my app/build.gradle android {