Does anyone know how to make a View reversed, I have a horizontal ProgressBar and I want it to right to left instead of left to right
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
You don't need to rotate the entire
View
.Just use a single xml attribute in your
my_progress_drawable.xml
:The documentation tells us that
gravity="right"
does this:Don't override
onDraw()
. This implementation is more stable across different versions of Android.Unfortunately, it's impossible to set the gravity of a
ClipDrawable
programmatically without invoking its constructor.You can flip a view in xml using scaleX or scaleY attributes
if you want it in XML there are two properties you can use. if you want to use
android:layoutDirection="rtl"
it requires minimum API 17 but if you useandroid:rotation="180"
there is no API limitationMake a subclass of the normal progress bar view and implement the onDraw method to rotate the canvas before drawing it:
This should do the trick.
Cos I'm lazy I just add these two lines to the
seekbar
xml:Any downsides to this?