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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:39:58+00:00 2026-06-09T04:39:58+00:00

I am using Horizontal ScrollView to get facebook like side navigation Like this: But

  • 0

I am using Horizontal ScrollView to get facebook like side navigation

Like this:

enter image description here

But how to show that “2” beside the Event item in the menu?

In my application i am using a ViewUtil class to get this menu:

public class ViewUtils {

    private ViewUtils() {

    }

    public static void setViewWidths(View view, View[] views) {
        int w = view.getWidth();
        int h = view.getHeight();
        for (int i = 0; i < views.length; i++) {
            View v = views[i];
            v.layout((i + 1) * w, 0, (i + 2) * w, h);
            printView("view[" + i + "]", v);
        }
    }

    public static void printView(String msg, View v) {
        System.out.println(msg + "=" + v);
        if (null == v) {
            return;
        }
        System.out.print("[" + v.getLeft());
        System.out.print(", " + v.getTop());
        System.out.print(", w=" + v.getWidth());
        System.out.println(", h=" + v.getHeight() + "]");
        System.out.println("mw=" + v.getMeasuredWidth() + ", mh="
                + v.getMeasuredHeight());
        System.out.println("scroll [" + v.getScrollX() + "," + v.getScrollY()
                + "]");
    }

    public static void initListView(Context context, ListView listView,
            String prefix, int numItems, int layout) {
        // By using setAdpater method in listview we an add string array in
        // list.
        String[] arr = new String[numItems];
        arr[0] = "Feed";
        arr[1] = "Friends";
        arr[2] = "Notifications";
        arr[3] = "Feedback";
        arr[4] = "Logout";
        listView.setAdapter(new ArrayAdapter<String>(context, layout, arr));

    }
}

and set the adapter like this in the Activity:

    ViewUtils.initListView(this, myListView, "Menu ", 5,
            android.R.layout.simple_list_item_1);

I what my “Notifications” Text to be something like “Notification n” where n is like the “2” in the above pic. I tried to use Spannable String but i cannot set the Spannable String to the String Array “arr”

Thank You

  • 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-09T04:40:01+00:00Added an answer on June 9, 2026 at 4:40 am

    I’m assuming those categories (News Feed, Messages,…) are items of a ListView.
    Also, for displaying that “2” I’m assuming you will need a custom adapter.

    In this case you just need to add a TextView to your row XML file and set the appropriate value in the getView() method of your custom Adapter, or, if you are create the TextView programaticaly in the getView() method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a Telerik MVC Splitter like this: @(Html.Telerik().Splitter().Name(MainSplitter) _ .Orientation(SplitterOrientation.Horizontal) _ .HtmlAttributes( New
I'd like to have one big scrollview with horizontal scrolling enabled. Within this scrollView
I am using Horizontal Scrollview in android to show images in my app, i
This is the layout I am using: <ScrollView xmlns:android=http://schemas.android.com/apk/res/android android:background=@color/background android:layout_width=fill_parent android:layout_height=fill_parent android:padding=30dip >
I am using Horizontal Scroll View, dynamically i will add items in to that.
Using this I tried to create a custom ListAdapter that would simply add all
I am using a layout with Scroll View. But in Logcat I got this
I have a horizontal scrollview with : [journal setPagingEnabled:YES]; I've been using a custom
I am using a scrollview to display various items in a horizontal fashion. How
I add One ScrollView in that i put image when i resize image using

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.