Material Design Button. Выделяемая область при нажатии на кнопку!
Имеется два MaterialButton расположенных в CardView (LinearLayout). При нажатии на button выделяется не вся область, которая показана в designer при наведении на button (эта область отмечена красным прямоугольником на картинке). Как сделать так, чтобы при нажатии на кнопку выделялась вся область, выделенная на button. Просто при нажатии на button между ними образуется некий образ, которого не должно быть.

<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBackgroundSetting"
tools:context=".Settings">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardPreventCornerOverlap="false"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.button.MaterialButton
style="@style/SettingButtons"
android:text="@string/change_email">
</com.google.android.material.button.MaterialButton>
<View
android:id="@+id/view1"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<com.google.android.material.button.MaterialButton
style="@style/SettingButtons"
android:text="@string/change_password">
</com.google.android.material.button.MaterialButton>
</LinearLayout>
</androidx.cardview.widget.CardView>
<style name="SettingButtons" parent="Widget.MaterialComponents.Button.TextButton">
<item name="android:gravity">fill_vertical</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">match_parent</item>
<item name="android:textColor">@color/colorTextSetting</item>
<item name="android:textSize">@dimen/text_size</item>
<item name="android:textAllCaps">false</item>
<item name="icon">@drawable/ic_chevron_right_black_24dp</item>
<item name="iconTint">@color/colorTextSetting</item>
<item name="iconGravity">end</item>
</style>
Ответы (2 шт):
Автор решения: V.March
→ Ссылка
Попробуйте такой вариант разметки:
<com.google.android.material.button.MaterialButton
style="@style/SettingButtons"
android:background="?attr/selectableItemBackground"
android:text="@string/change_password">
Автор решения: Nuclominus
→ Ссылка
Добавь в стиль две строчки. Это должно решить проблему
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>