Question

I'm making a RSS feed parser and and then inflate the UI using an array adapter. THe layout of the screen where the list would be made shows the list as big. However, when I actuallyy execute the application, it shows small titles. The layout goes like this,

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <ListView
        android:id="@+id/android:list"
        android:layout_width="wrap_content"
        android:layout_height="280dp" />

</LinearLayout>

Here is a Screenshot:

enter image description here

If anybody could tell me, how to make those lists look bigger, as I have a plan to parse the image url as well, and show it on the left of the posts.

Was it helpful?

Solution

Create a custom adapter that extends BaseAdapter. This will allow you to inflate a custom view for each row. In that view, simply make the text larger.

public View getView(final int position, View convertView, ViewGroup parent) {
    final ViewHolder holder;
    if (convertView == null) {
        convertView = context.getLayoutInflater().inflate(
                R.layout.apk_card, parent, false);
        holder = new ViewHolder();
        holder.appIcon = (ImageView) convertView.findViewById(R.id.appicon);
        holder.appName = (TextView) convertView.findViewById(R.id.appname);
        holder.statusIcon = (ImageView) convertView
                .findViewById(R.id.status_icon);
        holder.statusText = (TextView) convertView
                .findViewById(R.id.status_text);

        holder.status = convertView.findViewById(R.id.status);
        holder.details = convertView.findViewById(R.id.details);
        holder.launch = convertView.findViewById(R.id.launch);

        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    ApplicationInfo appInfo = getItem(position);
    Drawable appIcon = packageManager.getApplicationIcon(appInfo);

    String appName = packageManager.getApplicationLabel(appInfo).toString();

    holder.appName.setText(appName);
    holder.appIcon.setImageDrawable(appIcon);

    return convertView;
}

OTHER TIPS

Actually, All I did was use the Divider and DividerHeight properties of the ListView. :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top