A SeekBar is an extension of ProgressBar that adds a draggable thumb. The user can touch the thumb and drag left or right to set the current progress level or use the arrow keys. Placing focusable widgets to the left or right of a SeekBar is discouraged.
Add two images line and circle in drawable folder.
Main.axml:
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_height="wrap_content"
android:background="#ffffff">
<SeekBar
android:id="@+id/SB"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="0dp"
android:progressDrawable="@drawable/line"
android:thumb="@drawable/circle" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textStyle="bold"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:layout_marginLeft="10dp"
android:textSize="12dp"
android:id="@+id/tvValue" />
</LinearLayout>
Code for Changing progress of seek bar value dynamically in textview:
SeekBar SBMinSalesPrice = FindViewById<SeekBar>(Resource.Id.SB);
ShowProgress(SBMinSalesPrice, FindViewById<TextView>(Resource.Id.tvMinSalePriceValue));
void ShowProgress(SeekBar sbProgress, TextView tvValue)
{
sbProgress.ProgressChanged += delegate(object sender, SeekBar.ProgressChangedEventArgs e)
{
tvValue.Text = e.Progress.ToString();
};
}
No comments:
Post a Comment