What do I have to use to create a text input like evernote's?
It's look like they are using two edittext to create this, but even if I can have the same style for the upper part (whith one edittext), I don't know how to do the bottom part: it's look like the edittext is divided in two part, and the bottom part is taking the full screen.
Do I have to create some custom view?
It is easy. There are three main elements.
EditText with specified height (18sp for example) and width match_parent,
no padding/margin, 1dp height, match_parent width View element,
EditText with no padding/margin, width match_parent, specified height (36sp for example)
They also use hint option to display text in EditText, and View background color same as hint text color.
Related
I would like to have my 2-line text view in android-xml centered horizontally with the smallest width necessary. At the moment it's like the first line is completely filled and the second with the rest of the words.
Does anyone know how to achieve that both lines are filled kind of equally? Below are 2 images, the first showing the default multi-line text view, the second what I would like to achieve. As you can see, the second image requires much less width than the first and is more in the center of the view.
Thanks in advance!
Try setting android:breakStrategy attribute of textView to balanced
android:breakStrategy="balanced"
Add this line to your textView's xml code, this will balance the lines.
I thought that maximum width of a text View in android is display width of the device.I have scroll text that is extended from Linear Layout.By using animation class i can move the text, and its act like a automatic Scrolling text. My problem is the text length(String length 70) exceed the maximum width of the text view (1280 pixel). So the text 70 is show like this (...)
To make a TextView Scrollable the setMovementMethod() has to be called. However, there will be no scroll bar when scrolling it. To add a scroll bar, the android:scrollbars attribute has to be set in the layout file like this:
I set the button's height via XML. Suppose it to be X
<Button
android:layout_height="wrap_contnet"
android:textSize = " <X> dp"
....
....
/>
If I set X to greater than 15 dp, the button's height grows to fit the text. But when I set it to something lower like 2dp, the button's height doesn't change and I can see a thick border around it as shown below:-
As shown above, text size is so small but still height doesn't decrease!
How can I force it to be of appropriate height?
Thanx in advance!
Font size does not depend on button height. If you set it too small to fit the text, you will get the result you observe
EDIT
wrap_content would usually do the trick, however Button class sets some layout parameters like margin, background so it takes more space. You may get rid of Button and use i.e. TextView class, styled by hand to match your design. onClickListener will work perfectly fine with it and you will get result you want and full control over your button
EDIT 2
As this is bit related - there's AutoFitTextView widget on Github that deals with automatic text size scalling: https://github.com/grantland/android-autofittextview
Just Set android:minHeight="xxdp"
I can't really explain this, so I'll use an image:
OK, so as you can see, the actual EditText View is slightly taller than the actual white (editable area). How is this? I've removed all padding and margin that View has and still it looks bad.
Also I have another 2 problems with this EditText view when deploying it on the device:
It automatically captures focus (how can I disable this?)
When focusing it, there is an orange border, but the actual editable area is wider than the orange borders (see screenshot 2):
Here is the background of the pre Holo EditText:
And here is the background of the pre Holo EditText when its selected:
As you can see, those 9Patches already have paddings in them. So you the height of the EditText won't be the same as the height of the actual editable area. I would recommend you to set the height to wrap_content.
I was wondering about what is wrong with my layout.
Here is a screenshot.
Problem being that the text is being cut off in edit text boxes.
I suppose there is something wrong with the text's XY co-ordinates at the time of typing in those edit text boxes; the cursor blinks fine to me.
Here is the pastebin of my XML layout (not putting it here because its quite lengthy).
Any advice will be appreciated. Thanks
The text size of the text inside edittext is large for hardcoded 30dp height of edittext. You can either set edittext height to wrapcontent or reduce the textsize of edittext (10-14sp)so that it fits inside.
It is advised by android to set minimum height of clickable area to at least 48dp.
http://developer.android.com/design/style/metrics-grids.html