android-seekbar

Can i databind a ProgressBar in Android?

天涯浪子 提交于 2019-12-05 17:16:02
问题 Is it possible to use data-binding for a SeekBar or ProgressBar in Android? I have this data element: <data> <variable name="foo" type="com.example.Foo" /> </data> If i refer to the variable foo.bar (which is an int) in a TextField, it works as expected: <TextView android:text="@{String.valueOf(foo.bar)}" [...] What I tried to do was this: <SeekBar android:progress="@{foo.bar}" [...] but it wasn't recognized. (As soon as I wrote an "@" between the quotes, it got red in the editor). Is there

Custom inline SeekBarPreference - how to set SeekBar progress on the 1st run?

纵然是瞬间 提交于 2019-12-05 09:32:08
I have prepared a simple test project for my question at GitHub. In my project there is a custom inline SeekBarPreference , which mostly works fine (its summary is updated when seekbar is being dragged and it saves integer value): However there is a problem: On the very 1st run of the app (you might need to uninstall my app when you try see the error again) the progress of the SeekBar is not set (but the summaries are set): My question is: how to fix this issue in my code? I have tried adding mSeekBar.setProgress(mProgress) in different spots of SeekBarPreference.java , but just can't find the

Android - Custom SeekBar - round corners on progress bar

二次信任 提交于 2019-12-05 08:19:50
Trying to make a custom SeekBar. I want to achieve this. What I have done so far is this. I can't find a way to round the corners on the progress bar. Can someone help with this? Here is my code main_activity.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center"> <SeekBar android:id="@+id/seekBar1" android:layout_width="match_parent" android:layout_height="30dp" android:progressDrawable="@drawable/styled_progress" android:paddingLeft="15dp"

Android media player seekbar

这一生的挚爱 提交于 2019-12-05 01:14:43
问题 I have a service that creates, plays and handles a mediaplayer (just audio), yet I have a seekbar in the main activity that I want to, naturally, show the progress of the audio file and allow the user to seek to various positions. What I'm having a hell of a time figuring out is: what would be the best or proper way to connect the seekbar in the UI to the mediaplayer in the service? 回答1: Here is how I would do this: Bind to service that plays audio. The interface that server returns in onBind

How to make SeekBar take up full width of parent

混江龙づ霸主 提交于 2019-12-04 18:41:36
问题 I have a SeekBar in a RelativeLayout whose width is equal to the screen width. I applied layout_width="match_parent" to the SeekBar but it seems to keep some empty space on both sides of the SeekBar to accommodate the thumb. I also tried using android:thumb="@null" The thumb is gone but not the empty space on the sides. I really need to make the SeekBar width match the parent's. Could somebody help me with this? Maybe I could create a custom SeekBar class and set the width to the parent width

Android SeekBar Touch Sensitivity

血红的双手。 提交于 2019-12-04 17:40:21
问题 Recently I have been working on an app which has a SeekBar . The SeekBar is rather thin so it can at times be difficult to use it (you have to be very precise in your gestures). Is there any way to increase the touchable area of the SeekBar ? So I want users to be able to touch above or below the SeekBar to move the thumb. I'd appreciate any help you can offer! 回答1: One of the most straightforward approaches is to increase a value of the android:padding attribute: <SeekBar android:id="@+id

Can i databind a ProgressBar in Android?

孤人 提交于 2019-12-04 03:08:19
Is it possible to use data-binding for a SeekBar or ProgressBar in Android? I have this data element: <data> <variable name="foo" type="com.example.Foo" /> </data> If i refer to the variable foo.bar (which is an int) in a TextField, it works as expected: <TextView android:text="@{String.valueOf(foo.bar)}" [...] What I tried to do was this: <SeekBar android:progress="@{foo.bar}" [...] but it wasn't recognized. (As soon as I wrote an "@" between the quotes, it got red in the editor). Is there another way of data-binding it? To get the TextView to update when the SeekBar changes, bind to progress

AppCompatSeekBar left and right padding removal?

假如想象 提交于 2019-12-04 00:26:14
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <com.SocialMob.CustomViews.CustomTextView android:id="@+id/textViewCurrentDurationMusic" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="@dimen/_3sdp" android:singleLine="true" android:text="01:00" android:textColor="#AEAEAE"/> <android.support.v7.widget.AppCompatSeekBar android:id="@+id/seekBarMusic" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:max="100" android:paddingLeft="0px"

Android media player seekbar

核能气质少年 提交于 2019-12-03 16:15:45
I have a service that creates, plays and handles a mediaplayer (just audio), yet I have a seekbar in the main activity that I want to, naturally, show the progress of the audio file and allow the user to seek to various positions. What I'm having a hell of a time figuring out is: what would be the best or proper way to connect the seekbar in the UI to the mediaplayer in the service? inazaruk Here is how I would do this: Bind to service that plays audio. The interface that server returns in onBind should have getCurrentPos() and getDuration() functions. In your Activity's onCreate bind to

Android SeekBar Touch Sensitivity

对着背影说爱祢 提交于 2019-12-03 11:28:06
Recently I have been working on an app which has a SeekBar . The SeekBar is rather thin so it can at times be difficult to use it (you have to be very precise in your gestures). Is there any way to increase the touchable area of the SeekBar ? So I want users to be able to touch above or below the SeekBar to move the thumb. I'd appreciate any help you can offer! One of the most straightforward approaches is to increase a value of the android:padding attribute: <SeekBar android:id="@+id/yourSeekBar" android:progressDrawable="@drawable/seekbar_progress" android:thumb="@drawable/seekbar_thumb"