Adapt content into a TextView

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Adapt content into a TextView

Postby AsTeR » Tue Jun 24, 2008 8:26 am

My problem is the following :

I'm want to have an autowrap content in my TextView, but impossible for me
to find something that works, Android libraries are full of tools for
supress \n but i want them to be add when the container is too short for the
string.

If someone has an idea !
Last edited by AsTeR on Fri Jul 04, 2008 8:31 am, edited 1 time in total.
AsTeR
Junior Developer
Junior Developer
 
Posts: 19
Joined: Tue Jun 17, 2008 8:36 am

Top

Postby borya » Thu Jul 03, 2008 8:59 pm

I don't quite understand your question. But if you want to set the content of a TextView, have you tried using the TextView method setText(String) ?

if your TextView is defined in an XML layout file you need to retrieve it with something like

TextView t = (TextView)findViewById(R.id.your_text_view_id);
then you can do t.setText("some string"); to set the text in the TextView. If you were looking for something more complicated then I'm sorry to give you this silly answer, I must have grossly misunderstood your question :)
borya
Developer
Developer
 
Posts: 27
Joined: Wed Jul 02, 2008 7:50 pm
Location: California, USA

Postby AsTeR » Fri Jul 04, 2008 8:44 am

My problem was that this content was only display on one line. I know the method setText

My problem came from the context : this textfield was in a listview in an absolutelayout and it didn't well adapt its size. It was to big to the solution was to define the size (don't use the setPreferredSize method but the setLayout one).
AsTeR
Junior Developer
Junior Developer
 
Posts: 19
Joined: Tue Jun 17, 2008 8:36 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 8 guests