is there any way how to set text on button not from left to right, but from top to down?
Thanks
As far as I know, that's not possible.
However, if you find a solution I would not recommend using it. You're breaking the common way of how Android applications are meant to be designed. If an Android application is meant to be designed that way, Google would have a way to create a Button like you're describing.
May be you can statically specify button layout_width as some 5 dp or lower...and layout_height as wrap_content so that text will wrap next line..
then use setText..
Hope this helps...
If you create an Image, I mean a .png (and store it in drawable). In this png you store your word the way you want to be displayed. Then set that png as the button background then it may work for you.
Related
I have a xml layout for displaying some results, depending on the result type I need to adjust this view changing 2 textViews and one ImageView, the rest of the layout keeps without changes.
The solution I think is the best is to change the text and the image inside my java code (programmatically).
A friend suggests that is better to make a copy of the entire layout and change this 2 text labels and the image.
IMHO that leads into duplicated code that is why I do not think this is the best option. What do you think is the best approach ? Do you think of a better one?
Thanks in advance.
You are in the right direction. Using 2 different layouts for different results will be absolutely redundant. You can set TextView values by :
textView.setText("Your Text")
and Image resource programatically by:
imageView.setImageResource(R.drawable.yourImage); according to your result.
I wanted to create a custom text view. A little bit advance just as the text editor found here in StackOverflow, I can insert text and even images. I wanted to name this as WordView and create this as a library so I can reuse this across multiple projects.
Unfortunately I am not so sure if the base class allows this. I need a way to insert/paste images directly in the EditText. I am planning to write a custom View, although it seems laborious, I am not quite certain if this is possible at all and if I am going into the right track.
Have anyone tried similar before?
According to the Android Documentation for a TextView You can have a drawable object inside the TextView in the following ways
DrawableBottom
DrawableEnd
DrawableLeft
DrawableRight
DrawableStart
DrawableTop
There are other methods you can use, check out:
1. Programmatically set left drawable in a TextView
2. How to programmatically set drawableLeft on Android button?
3. http://androidsbs.blogspot.co.za/2013/12/androiddrawableleft-set-drawable-to.html
You could possibly implement this using HTML. I'm not sure about the paste functionality but generally it might work.
I have a design Mockup of a remote control with 4 buttons and a Text Display. Now i want to create an Android Activity which looks like this mockup. How can i do this.
I think taking the design image as background for the activity is not the right way to do this (how would i make the buttons on the image clickable, etc...)
Can anybody give me a hint how to start here?
kind regards
You should create 9-patches(or patterns) for each graphic element on your layout for proper layouting on all available devices.
Then apply this patterns to your UI elemnt's(ImageView's, Buttons, TextViews) backgrounds.
Refernces:
http://developer.android.com/tools/help/draw9patch.html - 9-patch documentation
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html - 9-patch creation
http://developer.android.com/guide/topics/ui/declaring-layout.html - Layouting
You can use your background easily but the rest need to be done in Android.
First : download android sdk
second : create your project
third : code :)
If you're familiar with HTML, that should be kinda similar. You separate the cliclable parts from the background (the buttons), and make them ImageView, setting an onClickListener.
You'll need some Photoshop skills to do that, or ask a buddy designer to do that for you :)
Be careful with multiple screen support, since the background may get trickier to make it look right on every supported screen size.
I am trying to use the Graphical Layout editor to make my app, so far so good but now I am in this problem:
I want the grey small textview to go a little higher but no matter what I do this isnt happening. How do those apps in the market have such beautiful GUIs when I can barely create a simple one? What are they using that I am not? :P Thanks.
Well, To fine tune the UI, you will eventually have to edit the generated XML. It would be good if you start getting your hands dirty with the XMLs. Please post the XML and then anyone would be able to suggest what changes to make.
I think you would probably reduce the padding or margin of the textview above.
Have you tried editing the XML and decreasing the top margin of the text? Or decreasing the bottom margin of the view above the text?
When I place things like text boxes they are fixed in one position and I can't move them around easily.
How can I edit the style and maybe put an image at the top of the text boxes and give the app a neat and pretty little layout?
Thanks
Use RelativeLayouts instead of LinearLayouts (i assume that you are using them) which allow free positioning.
To modify the theme/colors, read Applying Styles and Themes.
Create 9-patch graphics and assign them as backgrounds.
I am unsure if this is what you are looking for,but you can arrange the object on the layout from the xml files in res/layouts/ folder.Do not forget to follow the UI guidelines provided by google for android development. Also you can create custom themes for you app if you do not like the default template.