[英]Floating action Button visibility issue?
在下面的代碼中,我試圖讓 fab 按鈕在 sip 通話期間可見,而在通話結束時不可見。有些 fab7.show 不顯示任何內容,只有 fab8.hide() 在 oncallended function 中工作。 任何幫助將不勝感激。
在下面的代碼中,當 Fab 按鈕被觸摸超過 3 秒(在 onTouchListener 內)時,我正在調用 sendcall function 並同時使 fab8 可見。
當通話結束時,默認情況下低於 function oncallend function 被調用,因為 function 我正在隱藏 fab8。
fab.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
call.setListener(myListener);
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
down = System.currentTimeMillis();
break;
case MotionEvent.ACTION_UP:
//this is the time in milliseconds
re= System.currentTimeMillis();
differ = System.currentTimeMillis()- down;
if(differ>=3000){
sendingCall();
FloatingActionButton fab8 = (FloatingActionButton) findViewById(R.id.fab8);
fab8.show();
}
break;
}
每次通話結束時都會調用 onCallEnded function。 我在這里隱藏工廠按鈕
public void onCallEnded(SipAudioCall endedCall) {
FloatingActionButton fab8 = (FloatingActionButton) findViewById(R.id.fab8);
fab8.hide(); //***only hide works **
FloatingActionButton fab7 = (FloatingActionButton) findViewById(R.id.fab7); fab7.show(); //. ******does not shows********
Log.d("call", "Call ended.................................");
}
所以從我這里的樣子來看,你在 onTouch 事件中使用了.setVisibility(),在 onCallEnded 方法中使用了 hide() function。 因此,不要使用 using.hide 嘗試使用 setVisibility() 再次隱藏按鈕。
正如@shine 所建議的那樣,我只能在觸摸監聽器和 oncallEnd function 中使用顯示和隱藏。 由於 setvisibility 似乎不起作用,因此很可能已按照建議棄用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.