Using ?selectableItemBackground with a white background color
You can use the foreground of your FrameLayout : <FrameLayout … android:background=”@android:color/white” android:foreground=”?attr/selectableItemBackground”>
You can use the foreground of your FrameLayout : <FrameLayout … android:background=”@android:color/white” android:foreground=”?attr/selectableItemBackground”>
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
public MyAlertDialog( Context context, int theme ) extends AlertDialog { super(context, theme); getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); }
Use a text protection scrim(scroll down a bit). My example assumes the title text is white, so some tweaks may be necessary to optimize for your case. Inside your CollapsingToolbarLayout, add the following after ivBigImage: <View android:layout_width=”match_parent” android:layout_height=”@dimen/sheet_text_scrim_height_top” android:background=”@drawable/scrim_top” app:layout_collapseMode=”pin”/> <View android:layout_width=”match_parent” android:layout_height=”@dimen/sheet_text_scrim_height_bottom” android:layout_gravity=”bottom” android:layout_alignBottom=”@+id/image” android:background=”@drawable/scrim_bottom”/> In your Drawable folder, add: scrim_top.xml <shape xmlns:android=”http://schemas.android.com/apk/res/android”> <gradient … Read more
Try something like this : <style name=”ThemeName” parent=”@style/Theme.Sherlock.Light”> <item name=”actionMenuTextColor”>@color/white</item> <item name=”android:actionMenuTextColor”>@color/white</item> </style>
windowBackground only affects the main window’s background. colorBackground affects not only the background of the main window but also of all components e.g. dialogs unless you override it in the component layout. So both of them change the activity’s background, but the colorBackground changes many more things as well.
The solution is to change the style to <ProgressBar android:layout_width=”wrap_content” android:layout_height=”wrap_content” style=”?android:attr/progressBarStyleSmall” />
I tried to set android:titleTextAppearance of the toolbar but the style wasn’t being applied. Then I realized I’m using the AppCompat theme so I used app:titleTextAppearance and the style is now being applied. It looks like the small letters in landscape are a problem in the built-in AppCompat.Toolbar.Title style itself so I overrode it to … Read more
The constructor with Context and AttributeSet is used when your view is inflated from xml. You shouldn’t use it to create object. You should use constructor with Context as param. AttributeSet is interface and you can create instance of then and implement all method as is shown below: AttributeSet attrs = new AttributeSet(){ @Override public … Read more
However, I might not be taking the best approach, but this is how I have created some Switch like UIs in few of my apps. Here is the code – <RadioGroup android:checkedButton=”@+id/offer” android:id=”@+id/toggle” android:layout_width=”match_parent” android:layout_height=”30dp” android:layout_marginBottom=”@dimen/margin_medium” android:layout_marginLeft=”50dp” android:layout_marginRight=”50dp” android:layout_marginTop=”@dimen/margin_medium” android:background=”@drawable/pink_out_line” android:orientation=”horizontal”> <RadioButton android:layout_marginTop=”1dp” android:layout_marginBottom=”1dp” android:layout_marginLeft=”1dp” android:id=”@+id/search” android:background=”@drawable/toggle_widget_background” android:layout_width=”0dp” android:layout_height=”match_parent” android:layout_weight=”1″ android:button=”@null” android:gravity=”center” android:text=”Search” android:textColor=”@color/white” /> … Read more