* commit 'edba1dcd8ddc87a28d6ecb7b5272f6b995ff4024': More seek bars in ApiDemos
This commit is contained in:
@@ -14,23 +14,53 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingBottom="16dp">
|
||||||
|
|
||||||
<SeekBar android:id="@+id/seek"
|
<CheckBox
|
||||||
|
android:id="@+id/enabled"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/enabled" />
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekMin"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="0"
|
||||||
|
android:enabled="false" />
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekMax"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="100"
|
||||||
|
android:enabled="false" />
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seek"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:max="100"
|
android:max="100"
|
||||||
android:progress="50"
|
android:progress="50"
|
||||||
android:secondaryProgress="75" />
|
android:secondaryProgress="75" />
|
||||||
|
|
||||||
<TextView android:id="@+id/progress"
|
<TextView
|
||||||
|
android:id="@+id/progress"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<TextView android:id="@+id/tracking"
|
<TextView
|
||||||
|
android:id="@+id/tracking"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -983,6 +983,8 @@
|
|||||||
<string name="seekbar_tracking_off">Tracking off</string>
|
<string name="seekbar_tracking_off">Tracking off</string>
|
||||||
<string name="seekbar_from_touch">from touch</string>
|
<string name="seekbar_from_touch">from touch</string>
|
||||||
|
|
||||||
|
<string name="enabled">Enabled</string>
|
||||||
|
|
||||||
<string name="ratingbar_rating">Rating:</string>
|
<string name="ratingbar_rating">Rating:</string>
|
||||||
|
|
||||||
<string name="popup_menu_search">Search</string>
|
<string name="popup_menu_search">Search</string>
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ package com.example.android.apis.view;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -43,6 +46,16 @@ public class SeekBar1 extends Activity implements SeekBar.OnSeekBarChangeListene
|
|||||||
mSeekBar.setOnSeekBarChangeListener(this);
|
mSeekBar.setOnSeekBarChangeListener(this);
|
||||||
mProgressText = (TextView) findViewById(R.id.progress);
|
mProgressText = (TextView) findViewById(R.id.progress);
|
||||||
mTrackingText = (TextView) findViewById(R.id.tracking);
|
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) {
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) {
|
||||||
|
|||||||
Reference in New Issue
Block a user