diff --git a/samples/ApiDemos/res/layout/seekbar_1.xml b/samples/ApiDemos/res/layout/seekbar_1.xml index d3140b26b..79ece37b4 100644 --- a/samples/ApiDemos/res/layout/seekbar_1.xml +++ b/samples/ApiDemos/res/layout/seekbar_1.xml @@ -14,23 +14,53 @@ limitations under the License. --> - + android:layout_height="match_parent" + android:paddingStart="16dp" + android:paddingEnd="16dp" + android:paddingTop="16dp" + android:paddingBottom="16dp"> - + + + + + + - - diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml index 4b5993b4d..8b672e6c1 100644 --- a/samples/ApiDemos/res/values/strings.xml +++ b/samples/ApiDemos/res/values/strings.xml @@ -983,6 +983,8 @@ Tracking off from touch + Enabled + Rating: Search diff --git a/samples/ApiDemos/src/com/example/android/apis/view/SeekBar1.java b/samples/ApiDemos/src/com/example/android/apis/view/SeekBar1.java index 15bb013c2..65d01d4e2 100644 --- a/samples/ApiDemos/src/com/example/android/apis/view/SeekBar1.java +++ b/samples/ApiDemos/src/com/example/android/apis/view/SeekBar1.java @@ -18,6 +18,9 @@ package com.example.android.apis.view; import android.app.Activity; import android.os.Bundle; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.SeekBar; import android.widget.TextView; @@ -39,10 +42,20 @@ public class SeekBar1 extends Activity implements SeekBar.OnSeekBarChangeListene setContentView(R.layout.seekbar_1); - mSeekBar = (SeekBar)findViewById(R.id.seek); + mSeekBar = (SeekBar) findViewById(R.id.seek); mSeekBar.setOnSeekBarChangeListener(this); - mProgressText = (TextView)findViewById(R.id.progress); - mTrackingText = (TextView)findViewById(R.id.tracking); + mProgressText = (TextView) findViewById(R.id.progress); + mTrackingText = (TextView) findViewById(R.id.tracking); + + ((CheckBox) findViewById(R.id.enabled)).setOnCheckedChangeListener( + new OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + findViewById(R.id.seekMin).setEnabled(isChecked); + findViewById(R.id.seekMax).setEnabled(isChecked); + mSeekBar.setEnabled(isChecked); + } + }); } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) {