Adding glowing to TextView in android - java

I'm currently working on a project where I'm supposed to use text with a glowing background , something like this
Any ideas ?

You have to use android:shadowColor, android:shadowDx,android:shadowDy & android:shadowRadius in TextView defination inside xml. Check this discussion How to make text glow?

Related

Select and mark part of text in android

i want to select some part of the text from text view using long press and drag. Basically am looking for a functionality like android pdf reader text selection. how can i implement this? after select some text i need to highlight it (color change/underline etc) .When i again visit the same page, app should show the content like i previously highlighted.
I saw the textview.setTextIsSelectable(true) option,
when i use this i can select the text, whats next? is this the proper method for this kind of task ? please help.
You should use
textView.setSelection(startIndex, endIndex);
instead

How to add a permanent text which is tappable and editable along with hint, which user can change in EditText of android?

I looked on google but didn't find what exactly i am looking for.
I want a edit text to have text or image which i can change by tapping it and selecting new text or image. Also i want hint followed by that text or image.
I tried multiple experiment and was able to add text(by changing selection location and adding text) and image(using drawable addition from android code)
For text :
edt.setText("Fixed Text");
Selection.setSelection(edt.getText(), edt.getText().length());
Image through XML:
android:drawableLeft="#drawable/ic_launcher"
But when i add text, i won't be able to add hint. In case of image hints get added. Also i want my permanent text and image to be tappable and updatable.
Any help would be really helpful. I want $ to be fixed and tappable, and want to change it to different currency. but want 52.63 to be hint and can be editable by user tap.
EDIT to give more clarity:
Example: i want to add part of the text as permanent and part as hint for example $ 52, so $ is permanent and not editable through user, he can select it through list view by tapping on $, but 52 he can change using android keyboard.
I am not quite sure about the whole part about the image being placed into the EditText as a hint, but if you wanted to create the $52.63 as a hint in the EditText, all you would have to do is:
edt.setHint("$52.63");
in your onCreate() method. I am not sure if this is what you are looking for, but this is a simple way to add a hint to a textEdit. If you wanted the hint to change when the user tapped the screen or something like that, I would look into adding a tap listener of the android component that you desire to be tapped to change the hint, and then modify the hint using the method above.

Set Link Clickable in Java-Android

I am designing an App, where there is TextView, and based on some check condition, I want to make links / phone numbers in the TextView clickable in Java side. Can I do this, I don't want to make it clickable by default which is done by setting in xml file
android:autoLink="all"
What I already tried:
Create regular TextView and don't set autoLink="all",
TextView myView =
(TextView)view.findViewById(R.id.thisIstheTextView);
myView .setLinksClickable(true);
also tried :
myView .setMovementMethod(LinkMovementMethod.getInstance());
None of the above Java code works, I don't want a predesigned xml TextView with autoLink enabled, I want to change the TextView behavior in Java code based on if () conditions. There is no error in my code, but I am not able to achieve what I want. Can you please share your knowledge. Thank you.
Use setAutoLinkMask (int mask).
The possible values that can be combined for mask are those defined for the Linkify class.
Linkify.addLinks(myView, Linkify.ALL);
Fixed the issue.

How to write the "to the power" and some text like as shown in Java or Android?

As in the images shown below, is it possible to write code to write "to the power" in Android or Java?
Something like:
TextView t = (TextView) findViewById(R.id.text);
t.setText(Html.fromHtml("7<sup>2</sup>"));
According to Android documentation on their FAQ, you can always do this using a string resource, but if you do it on the fly you must make sure the TextView is using Spannable storage (always true if it's an EditText for example).
See Selecting, Highlighting, or Styling Portions of Text in the Android Common Tasks.
You can write HTML Code to show something like this.

Ability to view text in each class

Recently, I program for the Android platform. I have a question about the text.
Is there any way to display the text without using the XML?
I also want the text to be able to show in each class.
If you're asking if you can replace the text of anything programatically, yes you can. Usually, you have a setText method you can use for that. I'd advise you to read the tutorial and the javadoc to know more about this.

Categories

Resources