0
我有一個活動,按照我的意願進行佈置。當用戶點擊一個按鈕時,我顯示一個彈出式編輯文本框。我想在彈出的edittext和半透明的主層之間放置一箇中間層,以保持用戶的注意力集中在彈出窗口上。半透明層頂部的不透明層
所以我設置中間層的alpha值爲0.5。然而,即使我明確地將其alpha設置爲1.0,彈出層現在也呈現爲半透明。
<!-- this is the middle layer (I call it the 'curtain') -->
<LinearLayout
android:id="@+id/log_entry_reply_container_curtain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.5"
android:visibility="gone">
<!-- this is the popup layer -->
<RelativeLayout
android:id="@+id/log_entry_reply_container"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_gravity="center"
android:alpha="1.0"
style="@style/RoundedCornersView" >
<TextView
android:id="@+id/log_entry_tv_reply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textSize="22sp"
android:layout_marginBottom="5dp"
android:layout_alignParentTop="true"
android:text="@string/enter_reply"/>
<EditText
android:id="@+id/log_entry_reply_edittext"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_below="@+id/log_entry_tv_reply"
android:layout_margin="5dp"
android:gravity="top"/>
</RelativeLayout>
</LinearLayout>
如何讓這個中間層半透明,同時仍然保持頂層完全不透明?謝謝你的幫助!
非常感謝這一點。我將此標記爲解決方案,因爲它可行。然而,對於任何可能使用這個標籤的人,我會指出''的主體不需要任何'',''或''標籤。我需要解決的所有原始問題都是簡單的 '其中'cc'表示您希望應用於背景的任何Alpha值。感謝您的建議。它絕對有效! –
Alex