How to scroll text Horizontally in textview in android [duplicate] - android

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?

Related

Convert EditText to TextView Programatically? [duplicate]

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);

scrollbars="vertical" is not working in TextView [duplicate]

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());

Cant add border to Button using XML [duplicate]

This question already has answers here:
Rounded corners on material button
(8 answers)
Closed 4 years ago.
I just wanted to add a broder to my Button but its not working.
Main xml script:
button_style4.xml:
The Button appears normaly in the App and it works as I want it to work just the border is not appearing...
Someone find the fault?
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/button_border"
android:text="Example"
android:textColor="#color/black"
style="#style/Theme.AppCompat.NoActionBar"
/>

android:ellipsize="marquee" not working [duplicate]

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);

how we can design imageView in corner of textView in android? [duplicate]

This question already has answers here:
How to layout text to flow around an image
(9 answers)
Closed 6 years ago.
I am new in android so I am confuse in this design so please help me.
I want to design this type
Have you tried FlowTextView
How to use
Add to your XML layout with your child views inside it:
<uk.co.deanwild.flowtextview.FlowTextView
android:id="#+id/ftv"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="10dip"
android:src="#drawable/android"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="400dip"
android:padding="10dip"
android:src="#drawable/android2"/>
</uk.co.deanwild.flowtextview.FlowTextView>
Then in your code:
FlowTextView flowTextView = (FlowTextView) findViewById(R.id.ftv);
Spanned html = Html.fromHtml("<html>Your html goes here....");
flowTextView.setText(html);
Add the dependency:
compile 'uk.co.deanwild:flowtextview:2.0.2'
Output:
Enjoy...

Categories

Resources