我正在唱键盘视图来选择。选择键盘后,如何在textview android中显示选中的键盘文字?
我只能显示语言,但如何显示更改键盘的标题和摘要?
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onClick(View view) {
InputMethodManager imm = (InputMethodManager) MainActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();
InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();
String localeString = ims.getLocale();
Locale locale = new Locale(localeString);
String currentLanguage = locale.getDisplayLanguage();
Toast.makeText(MainActivity.this,currentLanguage,Toast.LENGTH_SHORT)
.show();
//Title and summary for change keyboard need to display
}
});
}
}