Reputation: 406
As you know, when a button is pressed, the shadow automatically gets increased. But the parent layout doesn't get affected by that change, as resulting, the shadow gets 'clipped off' or 'cut off' (pressing the + button):
How do I fix this in a proper way?
Note: This issue doesn't happen if I remove the android:gravity line of the root LinearLayout activity_main file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:paddingTop="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="num1"
android:gravity="center_horizontal"/>2
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="num2"
android:gravity="center_horizontal"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test123333333"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="#0ff"
android:text="+"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="#0ff"
android:text="-"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="#0ff"
android:text="*"
android:onClick="add"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="#0ff"
android:text="%"/>
</LinearLayout>
</LinearLayout>
Upvotes: 0
Views: 125
Reputation: 949
The shadow of a view does not its size. If your shadow gets larger than your view it is clipped by default.
To solve your problem you have the following options:
Button
such that the shadow is not clipped.android:clipToPadding="false"
Upvotes: 1