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);
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:
How to set the hint of autocomplete textview in android
(3 answers)
Closed 5 years ago.
<AutoCompleteTextView
android:id="#+id/edtname">
I have tried android:hint and android:CompletionHint, but unable to show hint text on the AutocompleteTextView.
Thanks in advance !
Set this on xml:
<AutoCompleteTextView
android:id="#+id/autoc"
android:layout_width="wrap_content"
android:layout_height="wrap_conten"
android:ems="10"
android:text=""
android:hint="HintYouWantToGive" />
<AutoCompleteTextView
android:id="#+id/autoCompleteTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="**Your Hint**" />
Use attribute android:hint to show hint text. You should use different color for hint text and background.
<AutoCompleteTextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="This is a hint"
android:textColorHint="#000000"
android:background="#FFFFFF" >
</AutoCompleteTextView>
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:
android ellipsize multiline textview
(23 answers)
Closed 9 years ago.
How can I make a multiline TextView that truncates the text properly? My TextView is part of a TableRow, so its width is a weight. The following does not work. The result is simply truncated text without the ellipses. I'm using API 10 (Android 2.3.3).
<TextView
android:id="#+id/name_recipe"
android:layout_centerHorizontal="true"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:text="Fried pork with mushrooms and potatoes and cilantro"
android:ellipsize="end"
android:maxLines="2"
android:paddingLeft="10dp" />
Reducing the two lines to a single line with the following does work, but it's not ideal:
android:singleLine="true"
I don't like this for two reasons:
android:singleLine is deprecated
I'd much prefer to have the text be on two lines than one.
I've seen discussion about this like from here but I'm hoping a new solution has been found by now.
Try this, it's from my project and works on phone but unfortunately not on tablet emulator:
<TextView
android:id="#+id/myItem"
android:layout_gravity="bottom|center_vertical"
android:textSize="10sp"
android:maxLines="2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ellipsize="end"
android:lines="2" />
Use lines="1" as all the other methods are deprecated. As well as set scrollHorizontally.
<TextView
android:id="#+id/myid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:scrollHorizontally="true"
android:ellipsize="end"
android:layout_weight="1"
/>
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?