1

Is this possible in xml at design time to rotate a button -90 degree so that I can align it to the right/left of the view?

enter image description here

JBird
  • 211
  • 3
  • 12

2 Answers2

0

Instead of rotating the button, Is there a reason you can't align it to the side and change the size, ie: instead of 306 dp by 29 dp aligned to the top, do 29 dp by 306 dp aligned to be on the left side.

jersam515
  • 657
  • 6
  • 22
  • because I'd like the text to rotate with the button. perhaps it's just matter of rotating the text label of the button, rather than the button itself. I'd like to have a drawer like-effect of pulling out a view overlaying the current view and as soon as it's released, for the overlay to fall back in place. But, I'd like the button to be as unobtrusive as possible... hence the right rotate align. – JBird Feb 20 '12 at 19:18
  • Just have another image of the button rotated 90 degrees and call on another view that uses that. – jersam515 Feb 20 '12 at 19:25
  • 1
    Good thought. Could do that. Several issues present however: 1. Need non-rendered text (because I won't have control over future translations) 2. Need both image and text option for button. Images are not always culturally relevant. – JBird Feb 20 '12 at 19:52
  • You don't need both the image of text and real text, also You would still be able to translate the text, look at this tut to show you what I mean: http://developer.android.com/resources/tutorials/localization/index.html – jersam515 Feb 20 '12 at 19:55
  • Sorry. I misunderstood your suggestion then. I thought you were suggesting to simply have a rendered image button in the orientation I need. – JBird Feb 20 '12 at 20:01
0

Are you talking about animating the button? If so, you can write an animation XML and save it in res/anim, and in your onCreate method in your Activity, you can call the animation on your button. But please provide more information; what do you want to do, and why (like jersam515 said), do you not just align it to parent left?

  • No. I don't want animation. That's fairly straightforward to do. So far, I don't see anyway to do this without an instantaneous animation. I added the mockup image above to provide an eg. – JBird Feb 20 '12 at 19:50
  • Oh, so you're basically asking how to have a vertical TextView? But with the characters oriented as if it were not vertical. Do you plan on changing this text or is it hard-coded? If you hard-code the text, it makes sense to just rotate the button in PS or whatever you used to design the UI. Otherwise, try this link, I think it has all the answers you want: http://stackoverflow.com/questions/1258275/vertical-rotated-label-in-android –  Feb 20 '12 at 19:55
  • Sadly, no. Text is multilingual. I'll check the link and get back to you. – JBird Feb 20 '12 at 20:01
  • 1
    Perfect. Override the button. Your link provided just the necessary code too. Answered. – JBird Feb 21 '12 at 00:29