Admiral Land
Admiral Land

Reputation: 2492

Android.ListView.How to set multiline text

Good day! I try to get list of news from site.And i did it!

But the news is very long,so not all text seen at ListView item.

How to make multiline ListView item or so on?I need that long string can be seen at item.

My code:

adapter = new ArrayAdapter<String>(this, R.layout.support_simple_spinner_dropdown_item,
        titleList);

 @Override
 protected void onPostExecute(String result) {

                lv.setAdapter(adapter);
                Log.i(Consts.TAG_LOG, "onPostExecute");
        }

Thank you!

Upvotes: 0

Views: 835

Answers (1)

rickyalbert
rickyalbert

Reputation: 2652

Try to build your personal ArrayAdapter and override his method:

View getView(int position, View convertView, ViewGroup parent)

Then build into a xml your personal row layout in which you put a TextView with multi-line attribute. For more references on custom adapter and custom row layout see this: http://www.vogella.com/tutorials/AndroidListView/article.html#adapterown

Upvotes: 1

Related Questions