2013-05-09 75 views
0

我工作的一個基於VOIP/SIP應用程序,它能夠從具有四個按鍵底部更新應用插件佈局動態

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" > 

<ImageButton 
    android:id="@+id/ibtn_handsfree" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:background="@drawable/selector_dialpad_action_button" 
    android:src="@drawable/selector_handsfree" /> 

<ImageButton 
    android:id="@+id/ibtn_headset" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:background="@drawable/selector_dialpad_action_button" 
    android:src="@drawable/selector_headset" /> 

<ImageButton 
    android:id="@+id/ibtn_copyToDir" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:background="@drawable/selector_dialpad_action_button" 
    android:src="@drawable/selector_copytodir" /> 

<ImageButton 
    android:id="@+id/ibtn_keyboard" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:background="@drawable/selector_dialpad_action_button" 
    android:src="@drawable/selector_keyboard" /> 
<ImageButton 
    android:id="@+id/ibtn_sendkey_widget" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:background="@drawable/selector_dialpad_action_button" 
    android:src="@drawable/selector_send_key_dialer" 
    /> 
</LinearLayout> 
  1. 撥號盤小部件撥打電話的是它氣餒我動態切換任何佈局 元素的可見性?例如,如果我希望隱藏第四個 按鈕,具體取決於任何活動呼叫(我相信 需要附加一個專用的監聽器)。
  2. 如果不阻止對小部件佈局的動態更改,請問我該怎麼做?

欣賞你的想法和幫助。

回答

1

我不知道第一個問題的答案,但爲了在切換的控件按鈕的可見性:

+0

嘿嘿,是啊,我瞭解的不多,但我需要切換visibilit y每當應用程序的調用狀態發生變化時,可能相當頻繁。 – 2013-05-09 07:25:52

+0

即使如此,以上也成立。您只需監聽呼叫狀態更改並相應地更新可視性。 – ozbek 2013-05-09 07:49:17

+0

我相信,爲了傾聽這一事件,我將需要專門爲此服務。 – 2013-05-09 07:58:13