Search code examples
androidandroid-layoutandroid-imageview

shift position of the content in an ImageView (mobile data type, e.g. 'LTE' or 'H') programmatically


Ryebread761's idea of rotating the Wifi signal icon is genius! (for the uninitiated, it uses an Xposed module to hook the layout call from SystemUI and rotate the Wifi signal icon before drawing.)

empty description

So I'm replicating this for the Cell Signal strength. Since we're the one receiving the signal strength from the tower, the POV should reflect this, like the Wifi icon does after Ryebread's mod.

As far as I can tell all I can do is rotate/mirror images. That works fine for this:

enter image description here

which turns into this

enter image description here

but not for this:

enter image description here

because when I rotate it, it's upside down.

What I would like, is to arrive at this, programmatically:

enter image description here

without having to provide a new SystemUI.apk for the user to flash.

Please note that using setPadding looks like it's causing the ImageView to scale down/get smaller/or something!


Solution

  • If you want to translate the ImageView instead of rotate it, use the setTranslationX() and setTranslationY() view property methods.