Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Listview show only one item
    text
    copied!<p>I have a ListView, where i changed appearence of row, but listview have size of one row, instead of fullscreen.</p> <p>list_item.xml:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content"/&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" &gt; &lt;TextView android:id="@+id/textView_news_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textColor="#0082A8" /&gt; &lt;TextView android:id="@+id/textView_news_header" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>tab_news.xml:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@+id/list_news" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre> <p>Making Adapter:</p> <pre><code>public class RSSAdapter extends ArrayAdapter&lt;RSSitem&gt; { Context context; int layoutResourceId; ArrayList&lt;RSSitem&gt; data = null; SimpleDateFormat sdf = new SimpleDateFormat("kk:mm "); public RSSAdapter(Context context, int layoutResourceId, ArrayList&lt;RSSitem&gt; data) { super(context, layoutResourceId, data); this.layoutResourceId = layoutResourceId; this.context = context; this.data = data; } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; NewsHolder holder = null; if(row == null) { LayoutInflater inflater = ((Activity)context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); holder = new NewsHolder(); holder.txtTime = (TextView)row.findViewById(R.id.textView_news_time); holder.txtNews = (TextView)row.findViewById(R.id.textView_news_header); row.setTag(holder); } else { holder = (NewsHolder)row.getTag(); } RSSitem item = data.get(position); holder.txtTime.setText(sdf.format(item.getPubDate())); holder.txtNews.setText(item.getTitle()); return row; } static class NewsHolder { TextView txtTime; TextView txtNews; } </code></pre> <p>Items are scrolling.</p> <p>Sorry for bad English. Thanks for help</p> <p>Advice of @Varun didn't help</p> <p>I found mistake. Thanks. Answer in "answers")</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload