私はアンドロイドで作業しています。私は私のアプリケーションでシークバーの機能を追加したい。Seekbar.getRight()とSeekbar.getLeft()が0を返しています
これは私のxmlファイルである: - 私は、これは常にゼロを返し、mSkbSample.getRight()
とmSkbSample.getLeft()
を印刷しようとした
<SeekBar
android:id="@+id/ProgressBar01"
android:layout_width="fill_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_height="60dp"
android:layout_below="@+id/incentives_textViewBottemLeft"
android:max="10"
android:progressDrawable="@drawable/incentive_progress"
android:secondaryProgress="0"
android:thumb="@drawable/incentives_progress_pin" />
And this is my java code related to this seek bar.
mSkbSample = (SeekBar)findViewById(R.id.ProgressBar01);
v1 = (TextView)findViewById(R.id.incentives_textViewAbove_process_pin);
v1.setText(String.valueOf(progress).toCharArray(), 0, String.valueOf(progress).length());
mSkbSample.setProgress(progress);
int xPos = ((mSkbSample.getRight() - mSkbSample.getLeft()) * mSkbSample.getProgress())/mSkbSample.getMax();
v1.setPadding(xPos,0,0,0);
。 私は何をしたのかを知るのを助けます。進捗状況やアンドロイド:secondaryProgressをいくつかの値で
あなたはこれをonCreateでやっていますか? – blessenm
はい、私はonCreateでこれをやっています。 –