IMKit 4.x:
可以在集成ConversationFragment的Activity的onResume方法中添加点击语音开关的逻辑,如下:
@Override protected void onResume() { super.onResume(); clickVoiceToggle(); } private void clickVoiceToggle() { if (initStatus) { voiceToggle = findViewById(R.id.rc_voice_toggle); voiceToggle.performClick(); initStatus = false; } }
initStatus初始化时为true
IMKit 5.x:
也是继承ConversationFragment, 然后在onResume里写这个逻辑:
@Override public void onResume() { super.onResume(); mRongExtension.updateInputMode(InputMode.VoiceInput); }