0
SeekBar
をダイアログボックスに追加しようとしているうちに、TextView
がSeekBar
のsetProgress()
を反映している必要があります。私はそのように実装:RelativeLayoutがビューのすべてに当てはまらない
private void customDialogTimeout() {
LinearLayout ll = new LinearLayout(getSherlockActivity());
ll.setOrientation(LinearLayout.VERTICAL);
RelativeLayout input = new RelativeLayout(getSherlockActivity());
final SeekBar timeoutSeekBar = new SeekBar(getSherlockActivity());
timeoutSeekBar.setId(1);
final TextView seekBarStatus = new TextView(getSherlockActivity());
seekBarStatus.setId(2);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
RelativeLayout.LayoutParams lay1 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
lay1.addRule(RelativeLayout.CENTER_VERTICAL);
lay1.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
RelativeLayout.LayoutParams lay2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
lay2.addRule(RelativeLayout.CENTER_VERTICAL);
lay2.addRule(RelativeLayout.RIGHT_OF, timeoutSeekBar.getId());
layoutParams.setMargins(30, 20, 30, 0);
input.addView(timeoutSeekBar,lay1);
input.addView(seekBarStatus, lay2);
ll.addView(input, layoutParams);
を結果ビューは、しかしTextView
を "押し出す" のようです:
私が間違って何をしているのですか?私が間違った方法でこれに近づいているなら、私に知らせてください。あなたのSeekBar