This question already has answers here:
Disabling of EditText in Android
(26 answers)
Closed 12 months ago.
What I Want
I want to convert EditText into TextView programmatically.
<EditText
android:id="#+id/inputValue"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="number" />
how can I convert the above EditText to below TextView
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
You can use 1 edittext and 1 Textview on same postion and hide them according to your need
or
You can use editText.setEnabled(false);
Related
This question already has answers here:
Making TextView scrollable on Android
(32 answers)
Closed 4 years ago.
Scrollbar is showing but not working or scrolling as shown in image below
XML:
<TextView
android:id="#+id/text_view_dialog_notes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:hint="#string/rv_notes_content"
android:padding="5dp"
android:scrollbars="vertical"
android:minLines="10"
android:maxLines="10"
android:textSize="17sp" />
Where is something wrong and how to fix it?
Using scrollbar on textView
you have to add this line in java
textView.setMovementMethod(new ScrollingMovementMethod());
make sure you add that to your code:
yourTextView.setMovementMethod(new ScrollingMovementMethod());
This question already has answers here:
Inserting imageview inside edittext android
(4 answers)
How can I add an image on EditText
(10 answers)
Closed 4 years ago.
I am using the EditText with drawableLeft property and set ImageView in Left side for displaying mobile icon. My Question is how to put Imageview in EditText?
Please help me.
Actually i want like this.
I have tried using linear layout with horizontal. below is xml code.
<LinearLayout
android:weightSum="2"
android:layout_below="#id/welcome"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_weight="1"
android:layout_gravity="center"
android:id="#+id/image_mobile"
android:layout_width="#dimen/_50sdp"
android:layout_height="#dimen/_50sdp"
android:src="#mipmap/ic_launcher" />
<EditText
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_30sdp"
android:layout_toRightOf="#+id/image_mobile"
android:hint="Mobile number"
android:inputType="text" />
</LinearLayout>
But am not able to adjust the image view and edittext.
You should use android:drawableStart
The drawable to be drawn to the start of the text.
DEMO
<EditText
......
android:drawableStart="#drawable/your_icon"
android:drawablePadding="5dp"
/>
This question already has answers here:
TextView Marquee not working [duplicate]
(20 answers)
Closed 4 years ago.
i have tried to use marquee but its not working,please help to solve this
<TextView
android:id="#+id/text_from"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textColor="#343d43"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="#id/text_to"
app:layout_constraintStart_toStartOf="#id/label_from"
app:layout_constraintTop_toBottomOf="#id/label_from" />
android:singleLine is Deprecated. Use
android:maxLines="1"
android:focusable="true"
FYI
You should add setSelected
Changes the selection state of this view. A view can be selected or
not. Note that selection is not the same as focus.
TextView text_fromOBJ=(TextView) findViewById(R.id.text_from);
text_fromOBJ.setSelected(true);
android:focusable="true"
android:focusableInTouchMode="true"
you need add this lines in java
TextView txtView=(TextView) findViewById(R.id.text_from);
txtView.setSelected(true);
This question already has answers here:
How to disable displaying "suggestions" on the Soft Keyboard
(9 answers)
Closed 8 years ago.
In my application , i have to submit Username and Password. But, it shows some suggestions while entering data. i am using the following in my xml.
<EditText
android:id="#+id/edtpass"
android:drawableLeft="#drawable/login_password_icon"
android:drawablePadding="15dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/edt_bg"
android:textColorHint="#FFFFFF"
android:hint="#string/password"
android:inputType="textNoSuggestions"
android:layout_marginTop="20dp"
android:layout_gravity="center"
android:padding="5dp"
android:imeOptions="actionDone"
android:singleLine="true"
android:textColor="#ffffff"
android:textCursorDrawable="#null"
/>
So, please guide me how to stop suggesstions.
In EditText:
android:inputType="text|textNoSuggestions"
In the layout XML, add the following attribute to your EditText:
android:inputType="textFilter"
check this http://developer.android.com/reference/android/widget/TextView.html#attr_android%3ainputType
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Horizontal scrolling text in Android
<TextView
android:id="#+id/dtitle"
android:layout_marginLeft="100dp"
android:text="Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollHorizontally="true"
/>
This is my code in xml file
Do you mean like a marquee?