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 9172433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:20:41+00:00 2026-06-17T16:20:41+00:00

I have a ListView setup with custom array adapter I want to change the

  • 0

I have a ListView setup with custom array adapter I want to change the font of each individual list items the getVIew() method code below does change the font but the fonts change as I scroll UP and down

public View getView(int position, View convertView, ViewGroup parent){
    View v = convertView;

    //View row = null;

    if (v == null) {
        LayoutInflater inflater = Main.this.getLayoutInflater();
        v = inflater.inflate(R.layout.genre_list, parent, false);
        TextView item = (TextView)v.findViewById(R.id.txtListText);
        switch(position) {
        case 0:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (1).ttf");item.setTypeface(tf);
            break;
        case 1:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (2).ttf"); item.setTypeface(tf);
            break;
        case 2:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (3).ttf"); item.setTypeface(tf);
            break;
        case 3:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (4).ttf"); item.setTypeface(tf);
            break;
        case 4:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (5).ttf"); item.setTypeface(tf);
            break;
        case 5:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (6).ttf"); item.setTypeface(tf);
            break;
        case 6:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (7).ttf"); item.setTypeface(tf);
            break;
        case 7:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (8).ttf"); item.setTypeface(tf);
            break;
        case 8:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (9).ttf"); item.setTypeface(tf);
            break;
        case 9:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (10).ttf"); item.setTypeface(tf);
            break;
        default:
            tf = Typeface.createFromAsset(getAssets(),"fonts/font (10).ttf"); item.setTypeface(tf);
        }
    }

    TextView item = (TextView)v.findViewById(R.id.txtListText);
    item.setText(Genres[position]);     

    // Declare and define the TextView, "icon." This is where
    // the icon in each row will appear.

    return v;
}
  • 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-17T16:20:42+00:00Added an answer on June 17, 2026 at 4:20 pm
    String[] typefaceArr = new String[] {"fonts/font (1).ttf", "fonts/font (2).ttf",     
    "fonts/font (3).ttf", "fonts/font (4).ttf", "fonts/font (5).ttf", "fonts/font (6).ttf",    
    "fonts/font (7).ttf", "fonts/font (8).ttf", "fonts/font (9).ttf", "fonts/font (10).ttf",     
    "fonts/font (10).ttf"};
    
        public View getView(int position, View convertView, ViewGroup parent)
        {
            View v = convertView;
    
            //View row = null;
    
            if (v == null) {
                LayoutInflater inflater = Main.this.getLayoutInflater();
                 v = inflater.inflate(R.layout.genre_list, parent, false);
                 TextView item = (TextView)v.findViewById(R.id.txtListText);
                 /*switch(position) {
                 case 0:
                      tf = Typeface.createFromAsset(getAssets(),"fonts/font (1).ttf");item.setTypeface(tf);
                      break;
                 case 1:
                      tf = Typeface.createFromAsset(getAssets(),"fonts/font (2).ttf"); item.setTypeface(tf);
                     break;
                 case 2:
                      tf = Typeface.createFromAsset(getAssets(),"fonts/font (3).ttf"); item.setTypeface(tf);
                     break;
                 case 3:
                      tf = Typeface.createFromAsset(getAssets(),"fonts/font (4).ttf"); item.setTypeface(tf);
                     break;
                 case 4:
                      tf = Typeface.createFromAsset(getAssets(),"fonts/font (5).ttf"); item.setTypeface(tf);
                     break;
                 case 5:
                      tf = Typeface.createFromAsset(getAssets(),"fonts/font (6).ttf"); item.setTypeface(tf);
                     break;
                 case 6:
                      tf = Typeface.createFromAsset(getAssets(),"fonts/font (7).ttf"); item.setTypeface(tf);
                     break;
                 case 7:
                      tf = Typeface.createFromAsset(getAssets(),"fonts/font (8).ttf"); item.setTypeface(tf);
                     break;
                 case 8:
                      tf = Typeface.createFromAsset(getAssets(),"fonts/font (9).ttf"); item.setTypeface(tf);
                     break;
                 case 9:
                      tf = Typeface.createFromAsset(getAssets(),"fonts/font (10).ttf"); item.setTypeface(tf);
                     break;
                 default:
                     tf = Typeface.createFromAsset(getAssets(),"fonts/font (10).ttf"); item.setTypeface(tf);
             }*/
            }
    
            TextView item = (TextView)v.findViewById(R.id.txtListText);
            item.setText(Genres[position]);
            tf = Typeface.createFromAsset(getAssets(),typefaceArr[position]);
            item.setTypeface(tf);
            // Declare and define the TextView, "icon." This is where
            // the icon in each row will appear.
    
    
            return v;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple ListView and I want each of it items to be
This is my setup. I have a custom ListView with some fancy headers, which
I have a listview embed in a spinner within the onCreate method. I want
I have a ListView with a custom view rendered by an adapter. It contains
I have created a custom listview and adapter by extending BaseAdapter. Every time I
I have created custom listview, each row looks like my file custom_row.xml. Is there
I have jquery mobile listview set up. I want to use jQuery to change
I am able to setup a listview using custom adapter which shows correct output..Now
I have a ListView with a custom CursorAdapter feed from a MatrixCursor . Each
I have a ListView setup in details mode that looks like this: When the

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.