假设我有2个片段,一个包含列表视图,另一个包含加载文本.我想当我点击一个列表项时,加载文本片段出现在列表视图的顶部.我已将加载文本背景的不透明度调整为:android:background ="#33FFFFFF".但它仍然只是在坚实的灰色背景上显示加载文本.
<?xml version="1.0" encoding="utf-8"?>
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@android:id/list"
android:background="#e8e9ee"
android:divider="#ccc"
android:dividerHeight="1dp"/>
Run Code Online (Sandbox Code Playgroud)
包含textview的片段:
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/loadingText"
android:id="@+id/loadingText"
android:textColor="#e8e9ee"
android:background="#33FFFFFF"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
Run Code Online (Sandbox Code Playgroud)
我的java代码基本上是这样的:onItemClick:
FragmentTransaction transaction=manager.beginTransaction();
transaction.show(loadingFragment);
transaction.commit();
Run Code Online (Sandbox Code Playgroud)