Search Results

Search found 911 results on 37 pages for 'textview'.

Page 3/37 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • TextView defined in main.xml - how to "name" it to be able to use - setText() method?

    - by Oliver Goossens
    Hi, I am exploring android and developement and I found one problem. My app UI is defined in main.xml I have 2 texts and 2 buttons defined - easy app. I read that I may be able to change TEXT in the ACTIVITY using the setText() method. And thats the problem - how do I POINT the setText() Method? How do I tell it to change a specified text? If I would declare the TextView inside the Activity with NEW TextView NAME Object, I would just need to use NAME.setText(STRING)... But I didnt so i dont have anything like NAME of the object? How can this be done? I read something about r.IDs but I truly dont have a idea how to use them, where to find them and how to implement it .... Please advise Thank you Oliver

    Read the article

  • Cursar move to the next line using textview

    - by user990918
    Hi friends i am trying to move curser move to the next line. it is worked but when i enter a character in textview curser again back to first line. please help me any one. i am writing below code.` if (textView == mailBodyTxtVew) { textView.text= [textView.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; //[textView resignFirstResponder]; // return NO; } `

    Read the article

  • ScrollView containing TextView does not scroll

    - by Dave Allison
    I have a textview displaying many individual words, each word is a link using Spans and setMovementMethod(LinkMovementMethod.getInstance()); The textview is wrapped by a ScrollView. However the ScrollView does not work as the links in the TextView are activated instead. Is there a way to combine a ScrollView and TextView so that both the scrolling and links in the text work?

    Read the article

  • get bitmap from textview in android

    - by Sponge
    I want to get the bitmap that is drawn when a textview is displayed but without displaying the textview in the activity. something like this: TextView t = new TextView(this); t.forceToDrawItself(); Bitmap b=t.getViewBitmap(); how is this possible?

    Read the article

  • Android AppWidget TextView: How to set background color programmaticly

    - by Amit
    I am trying to create an AppWidget, in which the background color of a TextView changes at random at specified periodic interval. The TextView is defined in layout xml file as <?xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="@+id/message" android:background="#ff99ff" android:text="Hello Widget" /> </LinearLayout> In update method, i have loaded the layout as RemoteViews remoteView=new RemoteViews(context.getPackageName(),R.layout.widget_message); To change the background of TextView i used the following statement remoteView.setInt(R.id.message, "setBackgroundResource", R.color.col_1); But i am getting a widget saying problem loading widget. If i remove the above line everything works fine. LogCat says: updateAppWidget couldn't find any view, using error view android.widget.RemoteViews$ActionException: view: android.widget.TextView can't use method with RemoteViews: setBackgroundResource(int)

    Read the article

  • Android AppWidget TextView: How to set background color at run time

    - by Amit
    I am trying to create an AppWidget, in which the background color of a TextView changes at random at specified periodic interval. The TextView is defined in layout xml file as <?xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="@+id/message" android:background="#ff99ff" android:text="Hello Widget" /> </LinearLayout> In update method, i have loaded the layout as RemoteViews remoteView=new RemoteViews(context.getPackageName(),R.layout.widget_message); To change the background of TextView i used the following statement remoteView.setInt(R.id.message, "setBackgroundResource", R.color.col_1); But i am getting a widget saying problem loading widget. If i remove the above line everything works fine. LogCat says: updateAppWidget couldn't find any view, using error view android.widget.RemoteViews$ActionException: view: android.widget.TextView can't use method with RemoteViews: setBackgroundResource(int)

    Read the article

  • Android TextView inside a ListView setTextHighlightColor() issue

    - by y ramesh rao
    I have Listview and Textview inside it now the thing is that i want to change the Text Color over the Selection of the that cell in the Listview but setting setTextHighlightColor of Textview is not giving this output I have tired setting a selector for this but that is not Heling too. Can this be solved. What might be causing the issue to populate. The Cell.xml is <ImageView android:id="@+id/thumbnail" android:layout_width="48dip" android:layout_height="48dip" android:layout_gravity="center_vertical" android:src="@drawable/icon" /> <TextView android:id="@+id/username" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/thumbnail" android:layout_alignParentTop="true" android:gravity="top" android:text="Username" android:textColor="@drawable/timeline_username_selector" /> <TextView android:id="@+id/time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginLeft="10px" android:text="31stMarch,2010" android:textColor="@drawable/timeline_username_selector" /> <TextView android:id="@+id/textTweet" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/username" android:layout_toRightOf="@id/thumbnail" android:layout_alignParentBottom="true" android:gravity="top" android:textColor="@drawable/timeline_tweet_selector" /> And the selector for the text color is something like this

    Read the article

  • How to create 3 equally wide TextView which fill parent across the screen

    - by hap497
    HI, Can you please tell me how can I create 3 equally wide TextView which fill parent across the screen? I tried doing this, but the width of the TextView are different: it is 149, 89, 89. <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="*" android:shrinkColumns="*"> <TextView android:id="@+id/t1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="0"/> <TextView android:id="@+id/t2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="1"/> <TextView android:id="@+id/t3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="2"/>

    Read the article

  • Applying style to perticuler character in textview.

    - by HellBoy
    Currently I am using 26 Textview so that I can apply style to particular character depending on runtime situation. But if I can able to apply style on particular character in textview I can achieve my goal using only one textview. e.g. If I want to make character 'M' red in following code. Is it possible to achieve this? <TextView android:id="@+id/TextView01" android:layout_height="wrap_content" android:textSize="20dip" android:textStyle="bold" android:layout_width="15dip" android:text="ABCDEFGHIJKLMNOPQRSTUVWXYZ" android:background="#FFFFFF" android:textColor="#000000"/>` Or anybody have better option than using 26 TextView it also welcome.

    Read the article

  • Textview with an Imageview as background, inputted text is behind the keyboard

    - by devb0yax
    Hi, I have here a view with an image and the text view (with finite frame size) . I've already implemented the textview keyboard notification but the problem is that when inputting in the textview it still behind the keyboard (the text is not visible). It seems this problem occur when I have an Image view as background. Pls advise me how to fix this. Here's my sample code: http://snipplr.com/view/35758/textview-input-is-behind-the-keyboard/ Thanks

    Read the article

  • Using selector to change TextView text color

    - by rafuru
    I'm trying to use a TextView to define the style of a TabWidget on a tabhost. I just created a selector for bgcolor and works fine, but i want to make a selector for textColor but the text color don't change: This is my tab_text_selector.xml: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_selected="true" android:color="@android:color/white" /> <item android:state_focused="true" android:color="@android:color/white" /> <item android:state_pressed="true" android:color="@android:color/white" /> </selector> And this is the code when i'm trying to use on a textView: TextView txtTab=new TextView(this); txtTab.setTextColor(R.drawable.tab_text_selector); txtTab.setBackgroundResource(R.drawable.tab_bg_selector); txtTab.setGravity(Gravity.CENTER); txtTab.setText("Agregar Idea"); I know the text color must be white in any case but it doesn't.

    Read the article

  • rendering a TextView in a Bitmap for an android widget

    - by foke
    I'm building a widget which displays some text. By widget I mean the kind which lies on the desktop. The problem is that I want to change text's font at runtime. There is several textview I would like, at runtime, to set the first as bold, the second blue and italic for example, etc. I came up with this : TextView tv = new TextView(context); tv.setText(stringToDisplay); tv.setTextColor(0xa00050ff); // example tv.setTextSize(30); // example Bitmap b = loadBitmapFromView(tv); updateViews.setImageViewBitmap(R.id.id_of_the_imageview, b); with private static Bitmap loadBitmapFromView(View v) { Bitmap b = Bitmap.createBitmap(v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height); v.draw(c); return b; } but it wont work (NullPointerException on first line of loadBitmap), until I replace v.getLayoutParams().width, v.getLayoutParams().height by fixed sizes like 250, 50 Bitmap b = Bitmap.createBitmap(250, 50, Bitmap.Config.ARGB_8888); // ... v.layout(0, 0, 250, 50); But that's not a good solution ... so I tried this : LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = li.inflate(R.layout.widget_text, null); TextView tv = (TextView) row.findViewById(R.id.id_of_the_textview); widget_text being a layout similar to the displayed one but with TextViews instead of ImageViews, in the hope to get some size information out of it .. but it's not working and I get this exception : 01-02 17:35:06.001: ERROR/AndroidRuntime(11025): Caused by: java.lang.IllegalArgumentException: width and height must be > 0 on the call to Bitmap.createBitmap() so, someone could point me in the right direction?

    Read the article

  • [Android] Is there a way to make ellipsize="marquee" always scroll?

    - by Matthias
    I want to use the marquee effect on a TextView, but the text is only being scrolled when the TextView gets focus. That's a problem, because in my case, it can't. I am using: android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" Is there a way to have the TextView always scroll its text? I've seen this being done in the Android Market app, where the app name will scroll in the title bar, even if it doesn't receive focus, but I couldn't find this being mentioned in the API docs.

    Read the article

  • iPhone SDK: TextView, Keyboard in Landscape mode

    - by Arnold
    Hello. How do I make sure that the textview is shown and the keyboard is not obscuring the textview, while in landscape. Using UICatalog I created a TextViewController which works. In it there are two methods for calling the keyboard and making sure that textView is positioned above the keyboard. his just works great in Portrait mode. I got the Landscape mode working, but on the textView is still being put to the top of the iPhone to compensate for the keyboard in portrait mode. I changed the methods for showing the keyboards. Below is the code for this methods: (I will just let see the code for show, since the hide code will be the reverse.. - (void)keyboardWillShow:(NSNotification *)aNotification { UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; if (orientation == UIInterfaceOrientationPortrait) { // the keyboard is showing so resize the table's height CGRect keyboardRect = [[[aNotification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue]; NSTimeInterval animationDuration = [[[aNotification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; CGRect frame = self.view.frame; frame.size.height -= keyboardRect.size.height; [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; [UIView setAnimationDuration:animationDuration]; self.view.frame = frame; [UIView commitAnimations]; } else if (orientation == UIInterfaceOrientationLandscapeLeft) { NSLog(@"Left"); // Verijderen later CGRect keyboardRect = [[[aNotification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue]; NSTimeInterval animationDuration = [[[aNotification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; CGRect frame = self.view.frame; frame.size.width -= keyboardRect.size.height; [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; [UIView setAnimationDuration:animationDuration]; self.view.frame = frame; [UIView commitAnimations]; } else if (orientation == UIInterfaceOrientationLandscapeRight){ NSLog(@"Right"); // verwijderen later. CGRect keyboardRect = [[[aNotification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue]; NSTimeInterval animationDuration = [[[aNotification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; CGRect frame = self.view.frame; frame.size.width -= keyboardRect.size.width; [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; [UIView setAnimationDuration:animationDuration]; self.view.frame = frame; [UIView commitAnimations]; } } I know that I have to change the line frame.size.height -= keyboardRect.size.height but I do not seem to get it working. I tried frame.size.width -= keyboardRect.size.height that did not work. Losing the keyboardRect and frame all together work, however off course the keyboard obscures the textview........

    Read the article

  • text view not wrapping

    - by leenolasco
    I just tried a sample of retrieving and passing it to a textview. I am having some trouble wrapping my textview. The bottom part is not completely shown. What do i need to add to the xml file for it to completely show the bottom part of the data? <?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" android:gravity="left" android:orientation="vertical" android:padding="5dp" > <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" > <TextView android:id="@+id/tvFA" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="36dp" android:layout_marginTop="36dp" android:text="TextView" android:maxLines = "1000" android:scrollbars = "vertical" android:textSize="20sp" /> </ScrollView> </RelativeLayout>

    Read the article

  • Android: Speeding up display of (html-formatted) text

    - by prepbgg
    My app uses a StringBuilder to assemble paragraphs of text which are then displayed in a TextView within a ScrollView. The displaytext.xml layout file is: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFFF" xmlns:android="http://schemas.android.com/apk/res/android"> <ScrollView android:id="@+id/ScrollView01" android:layout_width="fill_parent" android:layout_height="wrap_content" > <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/display_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#000000" > </TextView> </ScrollView> </LinearLayout> and the code that displays the StringBuilder object sbText is setContentView(R.layout.displaytext); TextView tv = (TextView)findViewById(R.id.display_text); tv.setText(Html.fromHtml(sbText.toString())); This works OK, except that it gets very slow as the amount of text grows. For example, to display 50 paragraphs totalling about 50KB of text takes over 5 seconds just to execute those three lines of code. Can anyone suggest how I can speed this up, please?

    Read the article

  • Updating Android Home Screen TextView

    - by jmontex2
    Hi, How can we update the View of a Home Screen Widget on the onReceive method of AppWidgetProvider?. I am trying to update the TextView of my Home screen widget but it seems that I cant access the TextView of my AppWidgetProvider on onReceive method. Here is a sample code of my onReceive public void onReceive(Context context,Intent intent) { final String action = intent.getAction(); if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) { final int appWidgetId = intent.getExtras().getInt( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { this.onDeleted(context, new int[] { appWidgetId }); } } else { if (intent.getAction().equals(ACTION_WIDGET_RECEIVER)) { String msg = "null"; try { msg = intent.getStringExtra("msg"); } catch (NullPointerException e) { } Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); // code for gathering the text to update the TextView } } super.onReceive(context, intent); }

    Read the article

  • How to customise the TextView inside a Spinner?

    - by Janusz
    I have a Spinner with an ArrayAdapter that feeds Values into it. The Problem is that the text is to long for the view and the result is a very very ugly spinner. As can be seen in the screenshot: I tried to pass the Id of my own TextView into the Adapter but everytime the spinner should be shown I get an Exception that the Id I supplied is not valid: 04-26 17:38:39.695: ERROR/AndroidRuntime(4276): android.content.res.Resources$NotFoundException: Resource ID #0x7f09003a type #0x12 is not valid Where do I have to define the TextView? In a separate xml file? With a surrounding viewgroup? It would help me a lot if I could see an example of the adapter initialization and the textview definition?

    Read the article

  • Changing Color with LinearLayout and TextView in Java (Android)

    - by Rob S.
    I'm a relatively new Android developer and I noticed what seems like an oddity to me that I'm hoping someone can explain. I have LinearLayout ll. This line of code fails for me when executed: ll.setBackgroundColor(R.color.white); However this line of code works: ll.setBackgroundResource(R.color.white); I assume its simply because I have white defined in my resources. However, I've also tried passing 0xFFFFFF in setBackgroundColor() and that doesn't work either. Similarly with my TextView text this line of code fails when executed: text.setTextColor(R.color.white); I can see my TextView so I know I initialized it correctly (like my LinearLayout which I can also see). So I guess my question boils down to: How do I properly use LinearLayout.setBackgroundColor() and TextView.setTextColor() ? Thanks a ton in advance. I've read through the docs and tried to find information online via googling and haven't come up with anything.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >