在下面的代码中,我试图使 fab 按钮在 sip 调用期间可见,并在调用结束时不可见。有些 fab7.show 不显示任何内容,只有 fab8.hide() 在 oncallend 函数内工作。任何帮助将不胜感激。
In the below code, when the Fab button was touched for more than 3 second(inside onTouchListener) , i am calling sendingcall function and at the same time make fab8 visible.
when the call is ended , by default below function oncallend function is called , in that function i am hiding 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 is called everytime when the call is ended. And here i am hiding fab button
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() 函数。 因此,不要使用 .hide ,而是尝试使用 setVisibility() 再次隐藏按钮。
关于java - float 操作按钮可见性问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58641861/