As I enter text in editText it should automatically underline the text I entered. I need like as I continue to enter text in editText it draw like in background.
Can someone help me.
Use view with 1 dp of height and custom width with green background , inside framelayout over your editText, and handle custom_width same as you are handling image_width.
For underline effect in EditText you need to add this
//initialize edittext before
editText.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
Related
I have editText which by default leaves lots of space. I added backgroud for textView, cause editText backgroud is not possible.
When I execute command: editText.setHeight(50); of no matter what integer it gives me same result:
My text gets cropped. I think somehow I need to reduce editText margins to fit my text here.
Main problem is that there is to much space between rows in first picture.
You can do like this
int reducedValue =5;
editText .setPadding(editText .getPaddingLeft()-reducedValue,
editText .getPaddingTop()-reducedValue,
editText .getPaddingRight()-reducedValue,
editText .getPaddingBottom()-reducedValue);
editText.setCompoundDrawablesWithIntrinsicBounds(editText .getPaddingLeft()-reducedValue,
editText .getPaddingTop()-reducedValue,
editText .getPaddingRight()-reducedValue,
editText .getPaddingBottom()-reducedValue);
I want to make a Text Editor like a Notepad ...I have created a simple Edit Text View but when I set its height to match_parent it start writing from the center of the screen and above when I add a line.
How should I customize my Edit Text View to make it multiline and view and edit for example a 20-line document?
use
android:gravity="top"
to start typing from top in editText
I design with android 4.0.3: theme.holo
When i change back color of edittext,It show lines is black color at first edittext.
How do hides black line of edittext when change background color?
Watch image: Click Here
you should be able to use
android:cursorVisible="false"
in your xml or
editTxt.setCursorVisible(false);
from java
EDIT:
Use an OnFocusChangeListener on the EditText to get a callback when it gets and loses focus and use the setCursorVisible() method to set the cursor to whichever state you need.
you can set android:textCursorDrawable="#null" in your layout
all
When i clicked in the EditText box to type something the border color of the EditTet box was changed.I dont need that,but i want to enter the text in the EditText box.
I tried a xml tag tag
android:focusable="false".
But its not working .How to do this?
Thanks in advance.
this probably will work..
editText.setOnFocusChangeListener(new OnFocusChangeListener(){
protected void onFocuschanged(){
editText.setBackground(#android:drawable.editbox_background);
}
});
go to editText in xml and add this tag,
android:gravity="left"
Easiest way I can think of is just use the editbox_background_normal ninepatch image and make yourself a selector that uses this image for the background in all states (default, focused, pressed) that way the view will not appear to the user to change at all.
Then just set the background of the EditText to your selector.
im using a edittext box drawable where the border is little graphical like it has two line border.the thing is if i enter the text its overlapping with the edge of the box.how can i create a space/ gap in the beginning,so that i can enter the text after 1/2 spaces gap from the left end.
Thanks
EditText editText = (EditText) findViewById(R.id.textId);
editText.setText("EditText component");
editText.setSelection(3);
try this code to set cursor to position 3.
If you just want to add space at strting try adding paddingLeft attribute in your code.
Thanks.