Как сделать непрозрачный фон для TextView
Как сделать,что бы линия ячейки (это editText) не перечеркивала фон TextView? Спасибо.
my xml file:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="1280dp"
android:layout_height="720dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="492dp"
android:layout_marginTop="191dp"
android:text="TEXT VIEW"
android:textColor="#2955D8"
android:letterSpacing="0.03"
android:textSize="12sp" />
<EditText
android:layout_width="326dp"
android:layout_height="54dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="201dp"
android:background="@drawable/edit_text_style"
android:ems="10"
android:importantForAutofill="no"
android:inputType="textPersonName" />
</FrameLayout>
Ответы (1 шт):
FrameLayout is designed to block out an area on the screen to display a single item. Generally, FrameLayout should be used to hold a single child view, because it can be difficult to organize child views in a way that's scalable to different screen sizes without the children overlapping each other.
По простому это означает, что FrameLayout должен содержать всего одного потомка, иначе будут проблемы с отображением. У вас внутри FrameLayout 2 потомка, которые как раз и накладываются друг на друга.
Вам надо внутри FrameLayout вписать 1 LinearLayout в вертикальным порядком следования и внутри него вписать свой TextView и EditText, примерно так:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="1280dp"
android:layout_height="720dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView ....>
<EditText ....>
</LinearLayout>
<FrameLayout>
