MaterialComponents theme alert dialog buttons

I figured out what was causing this problem. I need to use different AlertDialog class: androidx.appcompat.app.AlertDialog When I switched to this everything started working as expected. Here’s where I found the solution: https://github.com/material-components/material-components-android/issues/162

ActionBarSherlock stacked action bar styling issue

You have to change the android:actionBarDivider attribute which belongs to the theme, not to the action bar style android:divider. You can remove the divider like this: <style name=”AppTheme” parent=”Theme.Sherlock”> <item name=”actionBarDivider”>@null</item> <item name=”android:actionBarDivider”>@null</item> </style>

How to change the background color around a DialogFragment?

I had to set android:windowIsFloating to false and android:windowBackground to my custom color in the dialog style: styles.xml <resources xmlns:android=”http://schemas.android.com/apk/res/android”> <style name=”MyDialog” parent=”@android:style/Theme.Dialog”> <item name=”android:windowFrame”>@null</item> <item name=”android:windowBackground”>@color/orange_transparent</item> <item name=”android:windowIsFloating”>false</item> <item name=”android:windowContentOverlay”>@null</item> <item name=”android:windowTitleStyle”>@null</item> <item name=”android:colorBackgroundCacheHint”>@null</item> <item name=”android:windowAnimationStyle”>@android:style/Animation.Dialog</item> <item name=”android:windowSoftInputMode”>stateUnspecified|adjustPan</item> <item name=”android:gravity”>center</item> </style> </resources> MyDialogFragment public class MyDialogFragment extends DialogFragment { @Override public void onCreate(Bundle savedInstanceState) … Read more

How to change the style of a DatePicker in android?

call like this button5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub DialogFragment dialogfragment = new DatePickerDialogTheme(); dialogfragment.show(getFragmentManager(), “Theme”); } }); public static class DatePickerDialogTheme extends DialogFragment implements DatePickerDialog.OnDateSetListener{ @Override public Dialog onCreateDialog(Bundle savedInstanceState){ final Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = … Read more

Style bottom Line in Android

It’s kind of a hack, but I think this is probably the best way to do it. The dashed line will always be on the bottom, regardless of the height. <layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item> <shape android:shape=”rectangle” > <solid android:color=”#1bd4f6″ /> </shape> </item> <item android:top=”-2dp” android:right=”-2dp” android:left=”-2dp”> <shape> <solid android:color=”@android:color/transparent” /> <stroke android:dashGap=”10px” android:dashWidth=”10px” android:width=”1dp” android:color=”#ababb2″ /> … Read more

How to make a smaller RatingBar?

How to glue the code given here … Step-1. You need your own rating stars in res/drawable … Step-2 In res/drawable you need ratingstars.xml as follow … <?xml version=”1.0″ encoding=”utf-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:id=”@android:id/background” android:drawable=”@drawable/star_empty” /> <item android:id=”@android:id/secondaryProgress” android:drawable=”@drawable/star_empty” /> <item android:id=”@android:id/progress” android:drawable=”@drawable/star” /> </layer-list> Step-3 In res/values you need styles.xml as follow … <?xml … Read more

Custom attributes in styles.xml

I figured it out! The answer is to NOT specify the namespace in the style. <?xml version=”1.0″ encoding=”utf-8″ ?> <resources xmlns:android=”http://schemas.android.com/apk/res/android”> <style name=”CustomStyle”> <item name=”android:layout_width”>wrap_content</item> <item name=”android:layout_height”>wrap_content</item> <item name=”custom_attr”>value</item> <!– tee hee –> </style> </resources>

tech