Menu
  • HOME
  • TAGS

How to scroll text with seekbar?

android,textview,scrollview,seekbar

In my opninion you can do in this way: 1) create a Relativelayout on the left/right of you Seekbar 2) create a TextView inside this RelativeLayout 3) now you have to get the height of the RelativeLayout. To do that you can use onMeasure/onLayout(but in this way you have to...

Android put 2 textview in same order

android,textview

You should it in one TextView, then you should use something like this: SpannableString ss = new SpannableString("If you would like to provide feedback on the ehospice app, or report an error or problem, please send us an email."); ClickableSpan clickableSpan = new ClickableSpan() { @Override public void onClick(View textView)...

Http data is not showed on my TextView [android]

android,http,textview

Your code is not working because attempts to perform a networking operation on its main thread. For this reason you receive an NetworkOnMainThreadException The simplest solution to resolve the issue is to use an AsyncTask: public class SampleActivity extends Activity { TextView httpStuff; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);...

Close app and reopen Continue read text

android,textview,onresume

U should use SharedPreference class to save your text index. @Override public void onPause() { super.onPause(); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity()); pref.edit().putInt("stringListCounter", stringListCounter).commit(); } @Override public void onResume() { super.onResume(); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity()); stringListCounter = pref.getInt("stringListCounter", 0); } ...

Android app theme textViewStyle doesn't work on phone

android,xml,textview,styles,android-theme

"textViewStyle" is not defined in v22.1.1. You can find more detail from the link: https://code.google.com/p/android/issues/detail?id=170476

Animation of android TextView's text size and not the entire TextView

android,android-layout,textview

This could be achieved with a ValueAnimator and from the top of my head I think it should look something like this: final TextView tv = new TextView(getApplicationContext()); final float startSize = 42; final float endSize = 12; final int animationDuration = 600; // Animation duration in ms ValueAnimator animator...

Update TextView in inflated Layout

android,textview,layout-inflater

Why can't you add an id to your two text views in the XML and use TextView text = item.findViewById(R.id.your_id);

NullPointerException when long press on TextView with SpannableString

java,android,textview,spannablestring

You must add a method to catch the longClick event. In this case, if you want to control the TextView : tv.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(HomeSafeActivity.this, "Long preess", Toast.LENGTH_LONG).show(); return true; } }); ...

Difficulty generating a textview next to an existing textview on click

java,android,textview

A good practice is to define view styles in xml, for this very reason - it allows you to reuse them in different places. So I'd define the style for your TextView in res/values/style.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="textViewStyle" parent="@android:style/TextAppearance.Large"> <item name="android:textSize">50dp</item> </style> </resources> Then you can change the...

Change color Text from CustomTextView

android,textview

The below code is the way to set your default text color and typeface. public class CustomTextView extends TextView { public CustomTextView(Context context) { super(context); init(context); } public CustomTextView(Context context, AttributeSet attrs) { super(context, attrs); init(context); } public CustomTextView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context); }...

how to pass NetworkImageView(volley library) content to another actvity?

android,textview,imageview

I meet a similar problem. In my ListView, each item contains an ImageView to display images from server, and I need to show it in a View to support scale feature when user click the ImageView. I've tried this: holder.iv.setDrawingCacheEnabled(true); Bitmap bitmap = ((ImageView) v).getDrawingCache(); mBrowseImageListener.onBrowseImage(bitmap); But when the list...

Gather text-data from html file

java,android,textview

Your app can send a request to get your HTML page and then set the value of a TextView to be the content of the page as shown in this example: https://developer.android.com/training/volley/simple.html

How to make a TextView multiline programmatically in Android (Java)

java,android,textview,multiline

You want to show to different texts in the same textview? if so, use two text views like: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" />...

Comparing UI object in ios

ios,objective-c,uitableview,textview

If you are trying to compare pointers to find if your cell object is the same as the static one, you can use the == sign to compare it. In some other cases you can use NSObject's isEqual: method to check if they are "the same" (where "same" meaning may...

how to display data from a database into two Textview

android,sqlite,textview

You should use CustomAdapter which extends BaseAdapter Here is my sample TodoApp with CustomAdapter. You must inflate R.layout.elemento_lista in @Override public View getView(int position, View convertView, ViewGroup parent) { if(convertView == null){ convertView = inflater.inflate(R.layout.elemento_lista, null); } TextView title = (TextView) convertView.findViewById(R.id.todo_title); title.setText(getItem(position)); return convertView; } Then find your TextView...

Get Response, Url and Url code in Textview

android,android-asynctask,textview,android-textview

Don't access UI from doInBackground method Try The following private class LongOperation extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { try { String url = "http://google.com"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj .openConnection(); // Send post request con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(...

How to align a character vertically in a TextView?

android,textview

The problem with superscript is it places the bottom of the text at approximately the middle of the font. It does not align the tops or change the font to a smaller size, as my image example. The solution I have arrived to extends the SuperscriptSpan. This will shift the...

TextView with Html +

android,html,image,textview

In short, to make this happen, you need use the expanded overload of Html.fromHtml: description.setText(Html.fromHtml(new.getDescription(), new CustomImageGetter(), null)); And you have to create the CustomImageGetter itself (it implements ImageGetter), and make CustomImageGetter.getDrawable return a drawable constructed from your byte string. It might be easier to do a WebView, or to...

TabStopSpan.Standard constructor parameter

android,textview,spannablestring

Ok After researching it even further, I found the answer, it is in pixels but in DIP device independent pixels, so there is a need to convert it, I found it under this question Partially left aligned and partially right aligned text in a TextView. Why isn't this working?'t it...

RecyclerView ambiguos setVisibility function, clicking on one view affects multiple views

android,listview,textview,android-imageview,recyclerview

This happens because the views get recycled and reused. So when the view gets recycled, it retains properties of the "old" view if you don't change them again. So when you scroll down to number 12, the view that used to hold number 1 gets recycled (as it can't be...

How can I create a history of previously created TextViews in an Android App? One that the user can access

android,logging,textview,record,history

Store your results in a database.http://developer.android.com/training/basics/data-storage/databases.html

TextView not showing up on Android device?

android,textview,settext

Remove android:layout_toLeftOf="@+id/convert" in the "id/answer" TextView. Not quite sure offhand of the discrepancy between devices, but it seems to line up now. Also, I think there's a typo at <requestFocus />...

Create cyclic textview

android,textview,cyclic

You can use the Stringbuilder class to append the String from index 0. http://docs.oracle.com/javase/6/docs/api/java/lang/StringBuilder.html...

Show price - double as Integer depending on its value in TextView - Android [duplicate]

android,textview,integer,double

double num; //eg 9.00 or 8.75 long beforeDecimal = (long)num; double afterDecimal = num - beforeDecimal; if(afterDecimal>0) display num; else display beforeDecimal; ...

How can I set multiline TextView Ellipsis properly in LinearLayout

android,android-layout,textview

Your best bet is to utilize the maxLines and ellipsize attributes. <TextView android:id="@+id/detail" android:background="#0f0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxLines="2" android:ellipsize="end" android:text="afasdfasdfasfasdfasfdasfasdfasfasdfsadfasfasdfasdfasdf" /> ...

How to automatically adjust the TextView height according to the size of the String?

android,textview,size

Use a multi-line TextView and set layout_height to wrap_content: <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="false"/> Note: If you set layout_width to wrap_content it won't work properly. If you don't want the TextView to take up the entire width of the parent view then either: Set it to a fixed width in XML,...

Get the text from a TextView

android,textview

To get text from TextView, use .getText() and then convert it to string using .toString() String s = myTextview.getText().toString(); ...

How to prevent the TextView from being cutoff by the parent container?

android,textview,mpandroidchart

You can apply the android:clipChildren="false" android:clipToPadding="false" on your TextView's parent....

Android - Re-use TextView showing current date time in multiple activities

android,time,textview

Tell me if I understand you currectly, you dont want to make your textview inside an any activity, because you want to use it in all the life circle of the application? So if im understand you currect you want the application context. Then you can retrievegetResources() Im hope im...

how to change the background color of TextView if EditText is empty in android?

android,background,android-edittext,textview,textchanged

check count onTextChanged and choose the color: @Override public void onTextChanged(CharSequence s, int start, int before, int count) { int color = count == 0 ? R.color.light_green : R.color.grayColor; about_btn_Submit.setBackgroundColor(getResources().getColor(color)); } and you could do the same thing for the other TextView...

Android: Can't make small fontsize on programmatic textviews

android,textview,size

This turned out to be quite tricky and took me several hours to solve, but I'm posting the answer for anyone else who ends up in a similar situation. The cause: The entire drawable layer was the uppermost layer above a shape, and was therefore stretched to the size of...

Make Hyperlink in Textview android

android,textview

Please use spannable String for your String like as below: String value = "<html>By joining you agree to our <font color=\"#3C599F\" ><a href=\"http://www.google.com/\">TERMS</a></font> & <font color=\"#3C599F\" ><a href=\"http://www.google.com/\">PRIVACY POLICY</a></font></html>"; Spannable s = (Spannable) Html.fromHtml(value); URLSpan[] spans = s.getSpans(0, s.length(), URLSpan.class); for (URLSpan span: spans) { int start = s.getSpanStart(span); int...

Text.BoringLayout WIDTH is set to 0 (not showing) in Android TextView When I have an non-English text?

android,android-layout,textview,arabic,persian

Try displaying your text via HTML: mSubjectTextView.setText(Html.fromHtml("سلام")); ...

How to easily create hyperlink to activity (with intent) in TextView

android,hyperlink,textview,click

use this <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="http://www.imgur.com" android:autoLink="web" android:id="@+id/textView"/> this will open a pop up for the link you have given in text...

How can I place Button or TextView at the absolute bottom in RelativLayout?

android,xml,android-layout,textview,relativelayout

The solution to my question was very easy and provided by @Marco Dufal. Go in the dimens.xml in the res/values folder and set the margin to 0dp: <dimen name="activity_horizontal_margin">0dp</dimen> <dimen name="activity_vertical_margin">0dp</dimen> ...

How do i get information from textview?

android,textview

First of all, a user can't enter text on a TextView. You'll need an EditText for that. You already have EditText in your layout file, so initialize them like so EditText usernameEditText= (EditText) findViewById(R.id.userloginname); EditText passwordEditText = (EditText) findViewById(R.id.userpassword); Then inside your onClick() method public void onClick(View v) { String...

XML / Java Could not find method error when Button is used to edit TextView

java,android,xml,button,textview

remove this line from everywhere in your xml layout file android:theme="@android:style/Theme.Holo" and set the theme in styles.xml in values and values-v21 folder <style name="AppTheme" parent="Theme.AppCompat"> ...

Display complex Html text in android like gmail

android,html,webview,textview,monodroid

WebView webview = (WebView)this.findViewById(R.id.webview); String html = "<html><head><title>TITLE!!!</title></head>"; html += "<body><h1>text header</h1></body></html>"; webview.loadDataWithBaseURL(filePath, html, "text/html", "UTF-8", null); if there is no filePath: webview.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null); ...

How to display images in textview from server

android,image,textview

this is a snippet code from one of my old projects so please check it again ! while (matcher.find()) { try { // Maybe it's Text Before Image String textBeforImage = text.substring(offset, matcher.start()); offset += textBeforImage.length(); textBeforImage = textBeforImage.trim(); if (textBeforImage.length() != 0) { addTextView(textBeforImage); } // now , if...

How Display large Text in Page's like Book?

java,android,textview

you can use ViewPager Listing of main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:text="Page 1" android:id="@+id/textViewHeader" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:padding="10dip" android:textStyle="bold"></TextView>...

Android carriage return inside concatenated string

android,textview,concatenation,carriage-return

Try with TextView.setText("Tag is :\n" + result); or if necessary TextView.setText("Tag is :\n" + result.replaceAll("[^\\w]+", " ")); It just replaces any group of character which are not letter or digit by a space....

Android Get Country Emoji Flag Using Locale

android,textview,emoji

I was looking for that too but I don't think it's possible yet. Have a look here: http://developer.android.com/reference/java/util/Locale.html No mentioning about flags. _ Alternately you can check the answer here: Android Countries list with flags and availability of getting iso mobile codes that might help you....

How to enable the animation on textview borders in Android

android,xml,textview,android-animation

You could wrap your TextView in a FrameLayout, which has your background assigned to it. Add an onClick listener to your TextView which animates the alpha of your FrameLayout's background Drawable in/out appropriately. You may want to assign the background Drawable programatically to get a nice easy reference to it....

How do I make a textview fill the height of a linear layout?

android,android-layout,textview

The solution is to use android:fillViewport="true" on the ScrollView and change this LinearLayout android:id="@+id/note_view" child control height from wrap_content to fill_parent....

Android: TextView with multiples colors and fonts

android,textview,spannablestring

use getResource().getColor(R.color.light_gray) to retrieve the color you are passing to the ForegroundColorSpan. I doubt it is retrieving it internally for you. You probably need to instantiate a new ForegroundColorSpan at every iteration. It is not possible to reuse it

set items of LinearLayout at center screen programmatically

android,textview,android-linearlayout,relativelayout

Try like this LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.gravity= Gravity.CENTER_HORIZONTAL; row1TextView.setLayoutParams(params); ...

Characters appear in the order as i click

android,button,textview

You might want to try a slightly different approach. If I understand you correctly, you want to "type" a word out using given lettered buttons. Like one of those hangman style games. Why not append the text views on the fly. Something like @Override public void onClick(View v) { //Grab...

android - No Activity found to handle intent action.VIEW

android,exception,android-intent,android-fragments,textview

This occur when user clicks URL in text In this case, the URL is malformed: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=href (has extras) } The URL is href. That is not a valid URL. Here is the part where I do TextView html settings: That...

TextView setText is displaying ints instead of strings

android,textview,settext

You need to use getText or getString like getString(R.string.api_level) for string resource.

Android text over-enlarging text size

android,textview

By default text.setTextSize(float size) assumes you're passing the size in SP units, thus it's converting the SP to PX internally. On the other hand getResources().getDimension() is returning the unit in PX, internally doing the conversion from whatever value you set. So what's happening in your case you've set 20sp in...

Android string with HTML failed

android,html,textview

You have to wrap the string content into <Data></Data> <string name="my_string"><Data><![CDATA[<p>This is a paragraph!</p>]]> </Data></string> android string.xml reading html tags problem...

How can I add a text view for every item in my list?

java,android,textview

Should be able to do this with an adapter and listview: Activity.java: public class YourActivity extends Activity { ArrayList<String> reviewsArray = new ArrayList<String>(); ListView reviewList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.youractivity); reviewList = (ListView) findViewById(R.id.yourListViewId); //fill your reviewsArray... ArrayAdapter<String> reviewsAdapter = new ArrayAdapter<String>(context, R.layout.reviewLayout,...

Android textview adapter is not returning id of particular textview find with tag

java,android,textview,adapter,android-adapter

I believe that you are ... mistaking those two tags. setTag() can attach ANY object to the view, while the XML tag is only a string - I believe the findViewByTag will try to match the tag passed thru XML, not one attached through code - as it could be...

Custom TextView with icon

android,layout,textview,icons,drawable

use android:drawableTop to put the icon above the text and android:background just to draw the gray rectangle. Here you can find the documentation

Android - draw9patch should help me? background of textview

android,view,background,textview,imageview

i think you should use drawableLeft something like this : <EditText android:id="@+id/question_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint=" your question" android:drawableLeft="@drawable/ic_menu_info_details" android:layout_weight="1" android:singleLine="true" /> ...

Android TextView: text not shown if setText from HTML and android:singleLine=“true”

android,html,textview

android:singleLine has been more-or-less deprecated for a while. It only infrequently works. android:maxLines="1" is more typical nowadays.

how to display number in textview(activity2) from edittext(activity1) ? Say example phone number

android,eclipse,android-edittext,textview

Write: MobileNo1.setText("" + myNo); ...

Turkish characters are not shown on TextView

android,utf-8,textview

I solved my problem. Here is solution: in build.gradle(module:app) added this code: compileOptions.encoding = 'windows-1254' here is build gradle file apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "21.1.2" compileOptions.encoding = 'windows-1254' defaultConfig { applicationId "yazlm.beyaz.keyazarlar" minSdkVersion 14 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled...

Android - Checking value from an SQLite DB table

android,sqlite,textview

your slots definitely not null because of this : String slots = new String(); it should be String slots = null; Cursor cursor = database.query(ChosenSlotDatabaseHandler.TABLE_CHOSEN_PARKING_SLOT, chosenSlotColumn, null, null, null, null, null); if( cursor.moveToFirst() ) { slots = cursor.getString(0); } // make sure to close the cursor cursor.close(); return slots; EDIT...

Converting Text view to bitmap returns null

java,android,canvas,bitmap,textview

You did not add the text view to the the screen. Once you add it, the view height and width will be calculated for rendering and then only view will be drawn and you can get the bitmap out of it. Do the three things, Add the textview to the...

Get textColor attr from what was defined in xml

android,xml,attributes,textview

You can try this: final String androidNamespace = "http://schemas.android.com/apk/res/android"; String textColor = attrs.getAttributeValue(androidNamespace, "textColor"); ...

Position textView and control its width and height

android,textview

If I understood the question correctly, this should do it. Give it a height and width using dp, then use "align" and then margin. Example: <TextView android:text="@string/hello_world" android:layout_width="150dp" android:layout_height="100dp" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:layout_marginRight="10dp" android:layout_marginTop="10dp"/> ...

Whatsapp Message Layout - How to get time-view in the same row

android,android-layout,textview

Adding HTML non-breaking spaces did the trick. Tested the code on most devices and working absolutely fine. Maybe whatsapp is also doing the same thing. Below is the chat code: See images below to see it working. XML Design: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rel_layout_left" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/txtDate" android:visibility="visible" android:orientation="vertical" > <TextView...

To split Strings from a MultiAutoCompleteTextView and set it to different textview

android,textview,multiautocompletetextview

You can use String.split() like this: String[] array = yourString.split(","); And iterate through that array. EDIT: To check if the user already selected the item, you can add an OnItemClickListener to your multiAutoCompleteTextView and have a HashSet or a Set where your items clicked are stored and check if this...

Android Studio textview text isn't changing when I use setText in custom method

java,android,android-studio,textview,settext

It wont chagne becuase the data at SharedPreferences doesnt change. There is no need to restart the activity. No need AT ALL. Just setText() the textview. then save to sharedPrefrences for future starts.

TextView animation expand only one line

android,animation,textview

SOLVED I changed my expand method adding a listener in which i set the height to wrap_content at the end of the animation: private void expand(final View v) { v.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); v.getLayoutParams().height = 0; v.setVisibility(View.VISIBLE); final int targetHeight = v.getMeasuredHeight(); ValueAnimator mAnimator = slideAnimator(0, targetHeight); mAnimator.addListener(new Animator.AnimatorListener() {...

Change text color of a predefined layout

android,android-layout,textview,textcolor

If you don't want to use your own XML layout, you can get the TextView from that layout and set the color on that. The ID of the TextView in R.layout.simple_list_item_1 is android.R.id.text1 (see the source for that layout). TextView tv = (TextView) findViewById(android.R.id.text1); tv.setTextColor(getColor(R.color.new_text_color); ...

Update textView in appWidget android doesnt work properly

android,textview,runnable,android-appwidget

if you are using a layout file like this you need to findViewbyId so instead of creating a new textview like you are change the line to this. timerValue = (TextView) findViewById(R.id.timerValue) you should do the same for your buttons you also need to add action listeners to your buttons...

Create a new random number each time an activity is opened

android,random,textview

you are missing something here I believe, onCreate method, you should do something like this.. Random addition1 = new Random(); int additionint1 = addition1.nextInt(100)+1; TextView additionText1 = (TextView) findViewById(R.id.textView2); String additionString1 = String.valueOf(additionint1); additionText1.setText(additionString1); but the point is, it should be onCreate so that when you activity is created, the...

Prevent word from being broken in TextView

android,textview

the problem is in following line fullString = fullString.replaceAll(" ", "&#160"); remove it and it will work as you need, you don't need to replace space with html code, fromHtml will do it for you...

Android TextView invalidate doesn't work

java,android,android-layout,textview

setText has to be invoked on the UI thread. myTxtView.post(new Runnable() { public void run() { myTxtView.setText(distance); } }); ...

How to get the text onClick on a TextView that is created dynamically?

android,textview,onclicklistener

TextView txt_con = null; for(int i=0; i<usernames.size(); i++) { txt_con = new TextView(this); txt_con.setLayoutParams(lparams); txt_con.setPadding(0, 30, 0, 0); txt_con.setText(usernames.get(i)); ll_cont.addView(txt_cont); txt_con.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub @SuppressWarnings("unused") String str = txt_con.getText().toString(); } }); } ...

Jsoup select text WITH including html tags

java,android,html,textview,jsoup

See here: http://jsoup.org/cookbook/extracting-data/attributes-text-html Use the Element.html() method to get to the html including its inner html tags. You can also use Node.outerHtml() to the the html including the outer tags. In your case: Document doc = Jsoup.parse(response, "UTF-8"); Element elMotD = doc.select("td.info").first(); String motdHtml = elMotD.html(); ...

Getting strings from `Edittext` thats valid

android,android-edittext,textview

Create a List of EditTexts and then only take the value from the ones that are not empty and have a valid value. This is shown below using a button click to do the calculation. public class Main extends Activity { EditText ed1, ed2, ed3, ed4, ed5; TextView sum; Button...

Showing current time in Android and updating it?

android,time,textview

Something like this should do the trick final Handler someHandler = new Handler(getMainLooper()); someHandler.postDelayed(new Runnable() { @Override public void run() { tvClock.setText(new SimpleDateFormat("HH:mm", Locale.US).format(new Date())); someHandler.postDelayed(this, 1000); } }, 10); You should keep a reference to the handler and the runnable to cancel this when the Activity goes to pause...

How to get ListView underneath buttons

android,textview,alignment,android-linearlayout

I don´t know if this layout is really what You wanted, because everything is horizontal. I would prefere to set the parent LinearLayout to vertical and then add another LinearLayout. For example: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal|bottom" android:orientation="vertical" android:background="#000000" tools:context=".Visualizer"...

accessing children's properties after creating several Views

android,view,textview

loop through them ArrayList<String> strings = new ArrayList<String>(); ViewGroup vg = scrollView.getChildAt(0); // get its direct child for(int i = 0; i < vg.getChildCount(); i++){ //we loop through the views in the scrollview's direct //child and get the views and do what we want to do strings.add(((EditText)vg.getChildAt(i)).getText().toString()); } ...

Null Object Preferences Edittext on Android [closed]

android,textview,android-textview,null-object

Thanks for posting your layout xml. The error is caused by the fact that you should be calling: txt=(EditText)findViewById(R.id.txt); and not txt=(EditText)findViewById(R.id.text); since you don't have an EditText with that id in your layout....

First time programmer confused as to why the EditText and Button fields aren't going where I want them to

android,xml,textview,android-linearlayout,relativelayout

Use the below code in your layout: android:layout_alignParentTop will align the view on Top android:layout_alignParentTop will align the view on center of parent android:layout_centerHorizontal="true" and android:layout_centerVertical="true" will align the view in center of the parent Layout code with RelativeLayout <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"...

How can I make TalkBack ignore android:text element?

android,xml,textview,accessibility,talkback

You can hide a view from accessibility services by setting android:importantForAccessibility="no" in your layout XML. See the developer docs for View.setImportantForAccessibility(int) for more details.

Percentage symbol in TextView with one decimal point

android,textview,symbol

Have you tried this. textES.setText(String.format("%.1f",percentage) + "%"); ...

Android onLongClick bug with TextView

android,textview,relativelayout

I've found solution. It's strange as a problem. Several bugs appears after adding <item name="android:inputType">textFilter|textNoSuggestions</item> to styles. I don't why, but after removing this line, all things becomes right. It was one more bug - all TextViews becomes singleLine

how to set textview width wrap_content but limit to 1/3 of parent's width

android,textview,android-layout-weight

I think that you'll have to dynamically check the parent layout width every time you update the textView, something like (I have tested this code using a button and edit text to change the textView - works without problem) : <LinearLayout android:id="@+id/myLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/tvA" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true"...

Create custom selector

android,xml,android-layout,textview,drawable

After applying roarster's suggestion, you have to make TextViews clickable using android:clickable="true" The order of the items in the selector is important, because the selector will pick the first (from the top) item that matches the state of the view, therefore, the "default" state (with no android:state_* defined) should be...

How to Know What Part of a TextView was Selected

android,android-fragments,textview,onclicklistener

Don't even try to do this via onTouch. Use Spannables, and put each link inside a clickable span- http://developer.android.com/reference/android/text/style/ClickableSpan.html. Then when the text is clicked, its onClick method will be called and it can perform whatever action it needs to.

Changing the underline color of TextView

android,textview

It feels weird answering my own question, but for the sake of anyone having the same problem, I will. I have stumbled upon Layout class when reading some other posts for doing this on EditText. It provides everything you need to make this happen by manually drawing underline with canvas....

TextView class error.

android,textview

You should make your TextView mainTextView public, because else it is not accessable from the onClick method - it is defined only in the onCreate method. So put public TextView mainTextView; out of the methods (just before this lines @Override protected void onCreate(Bundle savedInstanceState) {) and remove TextView mainTextView; from...

How to change background of TextView From EditText Text Change?

android,colors,background,android-edittext,textview

My solution is a little modification of @GuiihE codes. Try this solution,it would work out as per your requirements: TextWatcher textWatcher = new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override...

Multiple clickable link in textview

android,html,textview,android-webview,android-toast

String htmlText = "<body><h1>Heading Text</h1><p>This tutorial " + "explains how to display " + "<strong>HTML </strong>text in android text view.&nbsp;</p>" + "Example from <a href=\"www.javatechig.com\">" + "Javatechig<a>,<a href=\"www.google.com\">" + "Google<a>,<a href=\"Male\">" + "Male<a>,<a href=\"Female\">" + "Female<a></body>"; setTextViewHTML(textView, htmlText); protected void setTextViewHTML(TextView text, String html) {...

Changing text of a TextView throws NullPointer Exception

java,android,exception,textview

The content is not set into the view, the findviewByid will return NULL if you do it BEFORE setContentView. move setContentView BEFORE findviewByid and it will work....

TextView in my getView() inside a adapter class throws null pointer exception

android,listview,textview,listadapter

you missed convertView.setTag(holder1) in the if clause. When convertView is not null, you are calling convertView.getTag() which is returning null if(convertView == null){ convertView = inflater.inflate(R.layout.searchlist_repeat_items, parent, false); Log.i("@@@@@ convert view is null", "@@@@@ convert view is null"); holder1 = new ViewHolder1(); holder1.companyName_textView = (TextView) convertView.findViewById(R.id.companyName_textView); convertView.setTag(holder1); } ...

How can I remove the border of a TextView item in a ListView

android,listview,textview,border

If you want to set listselector null you can do it like below : in xml android:listSelector="#00000000" through coding : myListView.setSelector(new ColorDrawable(0x0));...

XYZ Not working in android

android,html,tags,textview,clickable

tv.setText( Html.fromHtml("your string")); tv.setMovementMethod(LinkMovementMethod.getInstance()); and don't use android:autoLink="all" on TextView in XML. then try it should work........