seekbar

Changing the TextView color depending on the progress of a SeekBar

南楼画角 提交于 2019-12-06 17:11:19
问题 I am trying to change the color of the TextView depending on the SeekBar 's progress as following: 0-25% -> green 25%-50% -> yellow and so on... When I using the following code, the TextView doesn't show the value anymore. I would greatly appreciate any help! Code: public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { textView.setText(String.valueOf(progress + "%")); if(progress >= 25 && progress < 50) textView.setTextColor(R.color.Yellow); else if(progress >= 50 &&

Android - How to change default SeekBar thickness?

我们两清 提交于 2019-12-06 16:36:41
问题 I have this SeekBar: <SeekBar android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="26dp" android:id="@+id/seekbar" android:visibility="gone" android:maxHeight="3dp"/> I have tried to change this SeekBar thickness using maxHeight. But nothing changed. It looks like this: I want to change this SeekBar's thickness to 3dp and make look like this: So my question is it possible to change SeekBar thickness somehow? If yes, how? 回答1: You have to change

Android: Custom Drawable in a SeekBar widget is drawing aliased images

本秂侑毒 提交于 2019-12-06 13:39:22
问题 Problem is when I am using a custom progressDrawable in a SeekBar widget (perhaps incorrectly) it is rendered in a very aliased/ugly/low quality form. I have set "drawingCacheQuality" to high and there is no difference. Anyone have any ideas? Am developing on a Nexus One (OS 2.2.1) with target build for project as API 1.5 (though I would hope that shouldn't matter). Here is a sample of what it looks like: My aim is to create a simple nifty visual switch with two states (on and off), and a

Seekbar in Options Menu

僤鯓⒐⒋嵵緔 提交于 2019-12-06 12:49:46
I'm trying to add a seekbar item to my options menu, but all I get is a panel with my title for the text. In my main activity I'm doing this: @Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.activity_main, menu); return true; } And here is my activity_main.xml: <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/transparency_seekbar" android:showAsAction="never" android:title="test" android:actionViewClass="android.widget.SeekBar"/> </menu> So far as I know this isn't possible to customize the options-menu,

SeekBar's thumb only appears when touched

試著忘記壹切 提交于 2019-12-06 11:29:36
问题 I want to have a SeekBar with a thumb that appears as the user interacts with it (by dragging it to the desired location) and disappears after the interaction. Today my SeekBar looks like this: <SeekBar android:id="@+id/seekBar_volume" android:layout_width="fill_parent" android:progressDrawable="@drawable/custom_player_seekbar_background" android:paddingTop="10px" android:paddingBottom="10px" android:thumb="@drawable/myThumb" android:paddingLeft="30px" android:paddingRight="30px" android

How to add number scale on android SeekBar

六月ゝ 毕业季﹏ 提交于 2019-12-06 05:54:07
问题 I'm using the out of the box android SeekBar component. Below I would like to add the numbers form 1 to 5 showing the progress of the SeekBar. I have problem distributing the numbers correctly on the seek bar. Just like the image below 回答1: For drawing text over the seekbar thumb use this function public BitmapDrawable writeOnDrawable(int drawableId, String text){ Bitmap bm = BitmapFactory.decodeResource(getResources(), drawableId).copy(Bitmap.Config.ARGB_8888, true); Paint paint = new Paint(

How to design custom seekbar and volume control for ExoPlayer in Android

為{幸葍}努か 提交于 2019-12-06 05:16:05
I have tried this and this for Design Custom Seekbar for ExoPlayer but no luck. I want to design custom thumb and ProgressBar for ExoPlayer. Following is the XML for ExoPlayer where I've tried to put seekbar but it's not coming as expected. <com.google.android.exoplayer.AspectRatioFrameLayout android:id="@+id/video_frame" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center"> <SurfaceView android:id="@+id/surface_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center"/> <View android:id="@

how to change SeekBar color in android? (Programmatically)

青春壹個敷衍的年華 提交于 2019-12-06 03:19:33
问题 I made an equalizer to go with my app but I am not sure how I can change the seekbar's thumb and progress color. It seems to be pink by default and that doesn't fit my app's aesthetics. SeekBar seekBar = new SeekBar(this); seekBar.setId(i); seekBar.setLayoutParams(layoutParams); seekBar.setMax(upperEqualizerBandLevel - lowerEqualizerBandLevel); seekBar.setProgress(mEqualizer.getBandLevel(equalizerBandIndex)); //seekBar.setBackgroundColor(Color.DKGRAY); //seekBar.setDrawingCacheBackgroundColor

SeekBar Holo Theme using Support Library

白昼怎懂夜的黑 提交于 2019-12-06 02:42:19
I am using the Android Support Library v4 and v7 to get Fragments, Swipe-able View Pagers, and even ActionBar! It works and the graphics are really nice! However while the graphics for the above look nice and consistent in Android 2.x and Android 4.x, some common widgets look very different between versions. This leads to colours mismatch inside the app with an otherwise consistent look UI - so no matter what I draw in the rest of the UI, either the yellow SeekBar or blue SeekBar won't match something. I thought the whole point of the support library is to get a consistent UI across platforms,

Rectangular edges for custom SeekBar [duplicate]

混江龙づ霸主 提交于 2019-12-06 01:41:31
问题 This question already has an answer here : Removing rounded edges of a customized Seekbar? (1 answer) Closed 6 years ago . I have customize the SeekBar using a LayeredDrawable , The drawable works fine, but the drawable used as a background becomes rounded at the corners (Both the corner, here only the right end is shown. When the thumb is moved to the extreme left, the left corner is also rounded. Note: The original image is rectangular). How do I make it rectangular? Here is my