作者vvrr (vvrr)
看板AndroidDev
標題[問題] TextView setVisibility後背景不見
時間Thu Dec 25 12:37:12 2014
最近開始摸Android 的UI,發現了這個問題:
我的Layout想做成
在一個基本的排版上面再蓋一個TextView並且半透明,
1. 當touch到這個TextView的時候它會消失,再給user控制底下的東西
2. 當按back鍵,這個TextView會再蓋回來.
大概是這樣(我把和background有關的設定寫上來):
<AbsoluteLayout
android:background="@drawable/background"
>
<TableLayout
android:background="@drawable/background"
>
<ImageButton
android:background="
#00000000"
/>
</TableLayout>
<TextView
android:id="@+id/TextViewOverlay"
android:background="
#E0000000"
/>
</AbsoluteLayout>
程式部份,
我呼叫了 setVisibility(View.GONE),TextView的確消失了
呼叫 setVisibility(View.VISIBLE)的時候,TextView也回來了(上面的字有顯示)
但是原本應該是半透明的背景卻變成全透明……
想請問這原因可能出在什麼地方呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.250.31.103
※ 文章網址: http://www.ptt.cc/bbs/AndroidDev/M.1419482235.A.317.html
→ issuemylove: clean後再build try try 12/25 14:16
→ vvrr: 試過clean再重build,情形一樣 12/25 14:40
→ ckvir: 你設定Back回來之後再設一次透明勒 12/25 14:58
→ vvrr: !!!可以了... 12/25 15:19
→ vvrr: 我在setVisibility(View.VISIBLE); 後面加了 12/25 15:20
→ vvrr: setBackgroundColor(0xE0000000); 12/25 15:20
→ vvrr: 謝謝兩位的幫忙<(_ _)> 12/25 15:20