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

The Archive Base Latest Questions

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

Im designing my interfaces for my research project on android. So I added facebook

  • 0

Im designing my interfaces for my research project on android. So I added facebook kind side navigation listview. But when the itesms are added to the list view it will not get align center horizontally..I need to get the icon origin and the title in a same horizontal line. Please be kind enough to provide me a solution for my problem. Below provided my code. I’m sorry about my english.

Here is an image of my current interface. Please refer settings button. The settings word is bit upside. I need both icon and settings word aligh horizontally in same line.

image is here http://sphotos-e.ak.fbcdn.net/hphotos-ak-ash4/485944_4792129535506_1863888545_n.jpg

slide.xml – all the items for the listview are included here

<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
    android:id="@+id/item_one"
    android:icon="@drawable/settings"
    android:title="@string/item_one"
    android:top="30dp"
   >
</item>

    <item
    android:id="@+id/item_two"
    android:icon="@drawable/ic_launcher"
    android:title="@string/item_three">
</item>

<item
    android:id="@+id/item_three"
    android:icon="@drawable/ic_launcher"
    android:title="@string/item_three">
</item>
<item
    android:id="@+id/item_four"
    android:icon="@drawable/ic_launcher"
    android:title="@string/item_four">
</item>

 <item
    android:id="@+id/item_five"
    android:icon="@drawable/ic_launcher"
    android:title="@string/item_one">
</item>
<item
    android:id="@+id/item_six"
    android:icon="@drawable/ic_launcher"
    android:title="@string/item_two">
</item>
<item
    android:id="@+id/item_seven"
    android:icon="@drawable/ic_launcher"
    android:title="@string/item_three">
</item>
<item
    android:id="@+id/item_eight"
    android:icon="@drawable/ic_launcher"
    android:title="@string/item_four"
   >
</item>
</menu>

slidemenu.xml – the listview is here

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
     >

    <LinearLayout
        android:layout_width="260dip"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:background="#2c323f"

         >

        <ImageView
            android:id="@+id/menu_header"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left" 
            android:layout_marginTop="10dp"

            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            />

        <ListView
            android:id="@+id/menu_listview"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:scrollbars="none"
            android:background="#2c323f"
            android:fadingEdge="none"
            android:overScrollMode="never"
            android:listSelector="#454b5d"
            android:divider="@layout/divider"
            android:dividerHeight="1sp"
            android:cacheColorHint="#2c323f"

             />
    </LinearLayout>

    <FrameLayout
        android:id="@+id/overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </FrameLayout>

</LinearLayout>

here is my activity class

package com.coboltforge.slidemenuexample;

import com.coboltforge.slidemenu.SlideMenu;
import com.coboltforge.slidemenu.SlideMenu.SlideMenuItem;
import com.coboltforge.slidemenu.SlideMenuInterface.OnSlideMenuItemClickListener;

import android.app.Activity;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity implements OnSlideMenuItemClickListener {

    private SlideMenu slidemenu;
    private final static int MYITEMID = 42;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        /*
         * There are two ways to add the slide menu: 
         * From code or to inflate it from XML (then you have to declare it in the activities layout XML)
         */
        // this is from code. no XML declaration necessary, but you won't get state restored after rotation.
//      slidemenu = new SlideMenu(this, R.menu.slide, this, 333);
        // this inflates the menu from XML. open/closed state will be restored after rotation, but you'll have to call init.
        slidemenu = (SlideMenu) findViewById(R.id.slideMenu);
        slidemenu.init(this, R.menu.slide, this, 333);

        // this can set the menu to initially shown instead of hidden
//      slidemenu.setAsShown(); 

        // set optional header image
        slidemenu.setHeaderImage(getResources().getDrawable(R.drawable.ic_launcher));

        // this demonstrates how to dynamically add menu items
        SlideMenuItem item = new SlideMenuItem();
        item.id = MYITEMID;
        item.icon = getResources().getDrawable(R.drawable.ic_launcher);
        item.label = "Dynamically added item";
        slidemenu.addMenuItem(item);

        // connect the fallback button in case there is no ActionBar
        Button b = (Button) findViewById(R.id.buttonMenu);
        b.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                slidemenu.show();
            }
        });

    }



    public void onSlideMenuItemClick(int itemId) {

        switch(itemId) {
        case R.id.item_one:
            Toast.makeText(this, "Item one selected", Toast.LENGTH_SHORT).show();
            break;
        case R.id.item_two:
            Toast.makeText(this, "Item two selected", Toast.LENGTH_SHORT).show();
            break;
        case R.id.item_three:
            Toast.makeText(this, "Item three selected", Toast.LENGTH_SHORT).show();
            break;
        case R.id.item_four:
            Toast.makeText(this, "Item four selected", Toast.LENGTH_SHORT).show();
            break;
        case MYITEMID:
            Toast.makeText(this, "Dynamically added item selected", Toast.LENGTH_SHORT).show();
            break;
        }

    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch(item.getItemId()) {
        case android.R.id.home: // this is the app icon of the actionbar
            slidemenu.show();
            break;
        }
        return super.onOptionsItemSelected(item);
    }


}
  • 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-17T21:38:21+00:00Added an answer on June 17, 2026 at 9:38 pm

    the settings word is bit upside. I need both icon and settings word
    aligh horizontally in same line

    I’m guessing you use this library. The problem is that you can’t access the layout file that is used for the row view of the sliding menu adapter to modify it. But you can easily solve this if you copy the library’s code(which consists of very few files) and put it directly in your project. Then modify the slidemenu_listitem.xml file like this:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    
        <ImageView
            android:id="@+id/menu_icon"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_marginBottom="10dip"
            android:layout_marginLeft="10dip"
            android:layout_marginRight="5dip"
            android:layout_marginTop="10dip" />
    
        <TextView
            android:id="@+id/menu_label"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:layout_marginBottom="10dip"
            android:layout_marginTop="10dip"
    
            android:textSize="24dp" />
    
    </LinearLayout>
    

    Of course, you can always make a feature request to the user how made the library to modify it so you can insert your own layout file in the library(and wait for that to happen).

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

Sidebar

Related Questions

I am new to designing interfaces for Android. (I have gone through the Multiple
I am designing the user interface of a web application but I am inexperienced
Designing forms has always been fun, but getting them to send email on the
I am designing a new System and I have a lot of Interfaces that
In Chapter 14 of Designing Web Interfaces , authors Scott and Neil define the
I started my first MySQL project designing the ERD, logical and physical diagrams .
I'm about to start a social web app project. While i was designing classes
According to this excellent presentation on designing RESTful interfaces, the preferred way to implement
In android, we can design user interfaces by two methods: Procedural and declarative .
When designing my software, I began with interfaces since this seems to be 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.