Reputation: 33
i want to transparent an edittext in both Background and textColor sides. so i used this lines in my java code:
tempEditText.setTextColor(Color.TRANSPARENT);
tempEditText.setBackgroundColor(Color.TRANSPARENT);
but unfortunately this tempEditText object shows when i start typing any character on it. i want it to be completely invisible when i typing somthing to it. so i want it to be focused, get some texts, and i want the ability of retrieving strings that typed on it, but all in invisible state of edittext. i test visibility=invisible but in this situation the edittext cant give texts...
<EditText
android:id="@+id/tempEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:textColor="#00000000"
android:singleLine="true" />
any tips? thank you...
Upvotes: 3
Views: 7557
Reputation: 168
<EditText
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@null"
android:id="@+id/search_input"
app:layout_constraintLeft_toRightOf="@+id/filter"
app:layout_constraintRight_toLeftOf="@+id/search_button"
/>
use this line,then it will obviously work
android:background="@null"
Upvotes: 0
Reputation: 33544
Make the EditText
background attribute as #bb000000
for making it transparent.
If you are on Eclipse use the GUI to do it, or do this in your XML file android:background="#bb000000"
.
Upvotes: 0
Reputation: 31
Try this,
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0">
or programmatically you can set alpha to your EditText
editText.setAlpha(0.0f);
Note: The issue is user will not able to see cursor!
Upvotes: 1
Reputation: 294
I did this in my XML File :
android:textCursorDrawable="@null"
android:textColor="@android:color/transparent"
android:background="@null"
Upvotes: 0
Reputation: 56935
Change EditText background android:background="#00000000"
or android:background="@null"
in your xml file.
For Text Color android:textColor="#00000000"
in xml file.
Upvotes: 1
Reputation: 12239
Try:
android:background="@android:color/transparent"
or
android:background="@null"
Edit: show the virtual keyboard:
InputMethodManager imm = (InputMethodManager)getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(exampleView.getWindowToken(), 0);
Upvotes: 5