textview

Scroll text in a horizontal scroll view

末鹿安然 提交于 2020-01-14 03:56:07
问题 I have seen a few posts similar to my issue. However, the solutions mentioned in those posts did not help me fix the problem. Here is the scenario. I have a TextView in a horizontal scroll view. The idea is as soon as a text (larger than the view) is appended to the TextView, it must be automatically scrolled to end. Here is the layout snippet. <HorizontalScrollView android:id="@+id/horizontalScrollView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout

Place Button just after end of TextView in multilline TextView?

做~自己de王妃 提交于 2020-01-14 03:03:47
问题 I'm developing an Android application that contains some text view and button. I need to put Button just after the text view. When my TextView is single line that's working well. But when using multiple line of text view , my button was placed to the end of line 1. How to place button in the right position (after last line in the text view)? after edit : this is my xml , I use it in my code and generate it dynamically . <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"

SharedPreferences save a button change invisible after click on it and let appears another button

只愿长相守 提交于 2020-01-13 20:48:08
问题 I'm new here. I'm french so maybe my english is not very good, sorry for that. I'm a beginner in Android development, I got to create an app for finish my study. I have an activity number 1 called VoeuxActivity.java with 8 buttons (and 8 TextViews), they are all VISIBLEs at the beginning, when an user click on one of them button change by INVISIBLE (user can't see the button after clicked on it), when I quit the app and I come back again on my app, the button is always invisible thanks to the

SharedPreferences save a button change invisible after click on it and let appears another button

放肆的年华 提交于 2020-01-13 20:48:07
问题 I'm new here. I'm french so maybe my english is not very good, sorry for that. I'm a beginner in Android development, I got to create an app for finish my study. I have an activity number 1 called VoeuxActivity.java with 8 buttons (and 8 TextViews), they are all VISIBLEs at the beginning, when an user click on one of them button change by INVISIBLE (user can't see the button after clicked on it), when I quit the app and I come back again on my app, the button is always invisible thanks to the

How to add click listeners into a string in Android/Java Textview?

偶尔善良 提交于 2020-01-13 20:00:28
问题 What im trying to accomplish is something that is standard in most twitter apps, in a textview there may be an "@" mention or a "#" hashtag preceding a word in a text string and they are actually able to add a click listener onto that word that launches another activity, does anyone know how this is achieved? below I have attached an example photo showing what i'm trying to achieve, any help would go a long way thanks 回答1: Take a look at the Linkify class. It allows you to add Links within

How to add click listeners into a string in Android/Java Textview?

泪湿孤枕 提交于 2020-01-13 20:00:07
问题 What im trying to accomplish is something that is standard in most twitter apps, in a textview there may be an "@" mention or a "#" hashtag preceding a word in a text string and they are actually able to add a click listener onto that word that launches another activity, does anyone know how this is achieved? below I have attached an example photo showing what i'm trying to achieve, any help would go a long way thanks 回答1: Take a look at the Linkify class. It allows you to add Links within

Detect where Android's TextView would insert a line break

此生再无相见时 提交于 2020-01-13 09:30:08
问题 I have a rectangular tile, and I want to fit an image and some text into it. The image must not overlap the text, and the sizes of the image and the text can vary. The process must be hand-coded, since we have to fine-tune it according to our client's needs. I tried the approach of first measuring the rendered text bounds using getTextBounds() or measureText() and then adapting the font size and the image size so they don't overlap. This works fine if the text is only on one line. But if

How to correct ConstraintLayout TextView overlapping when more than two lines

牧云@^-^@ 提交于 2020-01-13 08:15:48
问题 I am having a problem with constraint layout where the text in one text view reaching the second line will not push down another text view that is constrained to be below it, until the middle of the line. I have built a simple layout with three text views. The first text view sits on the left and has a set width. The second one sits to the right of this, between it and its parent. The third sits below the second and to the left of the first. I want it to look like: However if I remove the

Detect if TextView spans over 2 lines

旧时模样 提交于 2020-01-13 07:36:06
问题 I wonder if there are any ways to detect either if string to be fitted into a text view reaches the end of screen and therefore change line, or if a textview spans over 2 lines? I want to know this so I can increase margins between some textviews if a textview spans over 2 lines, of course I want to do this dynamically. 回答1: TextView supports getLineCount() - See docs careful as you may need to check if the view has been drawn first. 来源: https://stackoverflow.com/questions/13444060/detect-if

Android paddings for Spannable?

五迷三道 提交于 2020-01-13 03:52:28
问题 I use this code to set background for piece of text inside TextView: s.setSpan(new BackgroundColorSpan(getResources().getColor(R.color.selection_blue)), prevIndex, index, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); But I need to set padding for this text too. Is it possible? 回答1: You can use ReplacementSpan . In your Activity: TextView tagsTextView = (TextView) mView.findViewById(R.id.tagsTextView); SpannableStringBuilder stringBuilder = new SpannableStringBuilder(); SpannableString tag = new