Today I've faced a problem:
In my custom layout there are LinearLayout with grey background and ToggleButton right after TextView inside this LinearLayout. Toggle button have transparent background. But in android Lollipop here are unnecessary shadow. I've tried elevation=0dp attribute. But this did't fixed my problem.
This happens when I'm set api = 21
And happens this on older apis < 21
Here is the sample layout:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="horizontal"
android:background="@color/grey_light">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0123" />
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:button="@android:color/transparent" />
</LinearLayout>
How to remove this shadow?
If you want an Android app to remove shadow from photo, you can use Remove Unwanted Content. Just like other apps, this app offers two selection tools including the lasso and brush tools which allows you to select the shadow areas from your image.
By default, android provides shadow for action bar. This example demonstrates How to remove shadow below the action bar. Step 1 - Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 - Add the following code to res/layout/activity_main.
A toggle button allows the user to change a setting between two states. You can add a basic toggle button to your layout with the ToggleButton object. Android 4.0 (API level 14) introduces another kind of toggle button called a switch that provides a slider control, which you can add with a Switch object.
In android, Toggle Button is a user interface control that is used to display ON (Checked) or OFF (Unchecked) states as a button with a light indicator. The ToggleButton is useful for the users to change the settings between two states either ON or OFF.
ToggleButton manages its elevation and translationZ with included state list animator. You can disable it by setting:
android:stateListAnimator="@null"
or by providing your own selector to handle these values:
android:stateListAnimator="@drawable/my_selector"
Try to use style="@android:style/Widget.Holo.Button.Borderless
Change the widget to appcompat (or whatever you are using).
I am using this:
style="?android:attr/borderlessButtonStyle"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With