Java 从片段中删除白色背景
我有一个片段,其中包含一个文本视图,我只想显示文本 默认情况下,片段放置如下白色背景 我只希望背景设置为透明 这是我对该片段的xmlJava 从片段中删除白色背景,java,android,android-fragments,android-linearlayout,transparency,Java,Android,Android Fragments,Android Linearlayout,Transparency,我有一个片段,其中包含一个文本视图,我只想显示文本 默认情况下,片段放置如下白色背景 我只希望背景设置为透明 这是我对该片段的xml <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background=&quo
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<TextView
android:id="@+id/cityNameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:textSize="25dp"
android:fontFamily="@font/baloo_thambi"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
我在堆栈溢出上找到了3个“明显的解决方案”。如下文所述,但这并没有解决任何问题