adding style dinamically to a TextView

by nou » Wed, 21 Apr 2010 06:54:27 GMT


Sponsored Links
 Hello

I have a String[] and I need to create a "paragraph" for each of the
strings in the array.

basically what I am doing at the moment is this:

      LinearLayout text = (LinearLayout)
this.findViewById(R.id.itemText);

      String[] ps = article.getATxt().split(Pattern.quote("\n"));

      for (String p : ps) {
         TextView newPar = new TextView(this);
         newPar.setPadding(0, 0, 0, 6);
         newPar.setText(p);
         text.addView(newPar);
      }

I am not happy with the way I format (padding) each new textView beign
created. I was wondering if there is a way to assign a style
dinamically so that I can extract from the code the styling.

Thanks

--



adding style dinamically to a TextView

by patbenatar » Wed, 21 Apr 2010 09:44:45 GMT


 This might help you:



Sponsored Links


Other Threads

1. why the alertdialog could not display ?

I am trying to display the dialog,but something is wrong when I do
it.I use a timer to do something. I want to use a dialog to let the
user konw, when the dialog  is end.
seekTask = new TimerTask()
......
seekTask.cancel();
new AlertDialog.Builder(mContext)
                .setTitle(R.string.seek_task_end)
                .setPositiveButton(R.string.btn_ok, new
DialogInterface.OnClickListener()
                        {
                        public void onClick(DialogInterface d, int which)
                        {
                                 d.dismiss();
                         }
                         })
         .show();

//Log.i("tag","message")  the log could not display.

--~--~---------~--~----~------------~-------~--~----~

2. What is really locked in the HTC Magic?

Hey,
Been thinkin of getting a device to get my apps on the actual road. I have
the Dev Phone option (although its not shipped to Portugal..thanks google by
the way...), but also the HTC Magic and soon the Samsung Galaxy. The Magic
is locked, but what this really means? Only the SIM is locked? Do i have all
the functionalities and developing opportunities as in the Dev Phone? Or is
it hardware-locked? A little help from you device developers would be
cool...

Thanks
Cheers

-- 
Cumprimentos,

Hugo Rafael Augusto

--~--~---------~--~----~------------~-------~--~----~

3. Spinner add values at run tim

4. Embedded webview crashes on dialog

5. Filter out contacts from contacts pick list || option to create new contact from pick list

6. Application Resources on SDCARD on install!! MUST HAVE, GOOGLE DO SOMETHING!!

7. Pin-Entr