0
ソフトキーボードを制御するinputMethodService
があります。ここでは画面が大きい場合、十分なボタンは、各画面の幅の1/5になるように、このコードの目的があるAndroid button.setWidth()は何もしません
@Override
public View onCreateInputView() {
LayoutInflater lInflate = getLayoutInflater();
Resources res = getResources();
LinearLayout inputView = (LinearLayout) lInflate.inflate(R.layout.copypasta, null);
Button tab_navySeal = (Button) inputView.findViewById(R.id.tab_navySeal);
Button tab_thatsome = (Button) inputView.findViewById(R.id.tab_thatsome);
Button tab_thethingis = (Button) inputView.findViewById(R.id.tab_thethinggis);
Button tab_identify = (Button) inputView.findViewById(R.id.tab_identify);
Button tab_othercopypasta = (Button) inputView.findViewById(R.id.tab_otherpasta);
int sW = res.getDisplayMetrics().widthPixels;
int bWidth = sW/5;
Log.i("DEBUG_TAG", Integer.toString(bWidth));
if(bWidth > 100) {
tab_navySeal.setWidth(bWidth);
tab_identify.setWidth(bWidth);
tab_thatsome.setWidth(bWidth);
tab_thethingis.setWidth(bWidth);
tab_othercopypasta.setWidth(bWidth);
}
return inputView;
}
の関連する部分です。それ以外の場合、画面が小さい場合、ボタンは100dpになります(HorizontalScrollView
で囲まれているので問題ありません)。
しかし、ソフトキーボードを開いても実際に何も起こっていません。上部の
ボタン各画面の1/5の代わりに広い100dpされなければならない:ここ
は、問題の画像です。この問題を考えると、各ボタンの幅はXMLで100dpに設定されています(プログラムの幅を設定するとXMLをオーバーライドする必要があるため、重要ではないとは思いますが)。
制御は、ifブロック内で起こっていますか? –
@Shadab安里「コントロール」とはどういう意味ですか? – Roymunson
ブロック内にloggingステートメントを追加し、印刷されているかどうかを確認します。 @シャドーヴァンズ –