Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8777205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:13:41+00:00 2026-06-13T19:13:41+00:00

I have a ListView for RSS, which I populate dynamically. I want to set

  • 0

I have a ListView for RSS, which I populate dynamically. I want to set style for items.
how can I do so?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:13:42+00:00Added an answer on June 13, 2026 at 7:13 pm

    row.xml

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="right"
        android:orientation="horizontal" >
    
        <TextView
            android:id="@+id/text"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.8"
            android:gravity="right"
            android:paddingRight="5dp"
            android:text="@string/app_name" />
    
        <ImageView
            android:id="@+id/img"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/bullet"
            android:contentDescription="@string/app_name" />
    
    </LinearLayout>
    

    main.xml

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
    
        <ListView
            android:id="@+id/mCustomList"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:divider="#666666"
            android:dividerHeight="0.05dp"
            android:scrollingCache="false" />
    
    </LinearLayout>
    

    CstListAdapter.java

    public class CstListAdapter extends BaseAdapter {
        private Activity activity;
        private ArrayList<CstItem> postList = new ArrayList<CstItem>();
        private static LayoutInflater inflater = null;
        private Context ctx;
    
    
        public CstListAdapter(Activity act, ArrayList<CstItem> d, Context ctx) {
                activity = act;
            postList = d;
            inflater = (LayoutInflater) activity
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    
            this.ctx = ctx;
        }
        @Override
        public int getCount() {
            return postList.size() < count ? postList.size() : count;
        }
    
        @Override
        public Object getItem(int position) {
            return position;
        }
    
        @Override
        public long getItemId(int position) {
            return position;
        }
    
        public static class ViewHolder {
            public TextView text;
            public ImageView img;
        }
    
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder;
            View row = convertView;
    
            if (row == null) {
                row = inflater.inflate(R.layout.row, null);
                holder = new ViewHolder();
                holder.text= (TextViewPlus) row.findViewById(R.id.text);
                holder.img= (TextViewPlus) row.findViewById(R.id.img);
                row.setTag(holder);
            } else
                holder = (ViewHolder) row.getTag();
            CstItem item = postList.get(position);
            holder.text.setText(item.getTitle());
    
            return row;
        }
    

    CstItem.java

    public class CstItem {
    
        private String title;
        private String thumbnail;
        private String url;
        private String description;
        private String pubDate;
    
    
        public String getTitle() {
            return title;
        }
    
        public void setTitle(String title) {
            this.title = title;
        }
    
        public String getThumbnail() {
            return thumbnail;
        }
    
        public void setThumbnail(String thumbnail) {
            this.thumbnail = thumbnail;
        }
    ...
    
    }
    

    Main.java

    public class Main extends Activity {
    
        private ListView mListView;
        private CstListAdapter cstListAdaptor;
        private ArrayList<CstItem> PostList = new ArrayList<CstItem>();
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            setContentView(R.layout.main);
            mListView = (ListView) findViewById(R.id.mCustomList);
    
            cstListAdaptor = new CstListAdapter(this, PostList, this);
    
            mListView.setAdapter(cstListAdaptor);
            PostList.clear();
    
            refreshRss();
    
            mListView.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view,
                        int position, long id) {
    
                    CstItem cit = PostList.get(position);
                    String cnt = cit.getDescription();
                    //...
    
                }
            });
        }
    ...
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListView which has custom elements inside of it. I want to
How can I recreate listView? I have listView with items containing few TextViews and
I have a ListView which sometimes I need to put around 10000 items in.
I have created an RSS reader that lists items in a listview. I also
I have listview with rounded corners. How can I set the background of these
I have listview control.There is an option to remove selected items.After the user removes
I have ListView that has the following EditItemTemplate: <EditItemTemplate> <tr style=> <td> <asp:LinkButton ID=UpdateButton
I have ListView in my project which has ListItems as in the form of
I have ListView which is saving all data to database. For adding i have
I have a ListView with Horizontal WrapPanel as its ItemsPanelTemplate. I want to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.