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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:02:02+00:00 2026-05-16T11:02:02+00:00

I want to layout a button with Drawable image on the top of it

  • 0

I want to layout a button with Drawable image on the top of it and text below the image. I am very new to this so please use detailed instructions. I have not experimented with drawable images yet so I want to clarify before I continue.

If I want to above the text (ie the text is not on the image) how do I go about doing this? I also want the text to be centered in below and (working without the drawable) there is a gravity command for center-horizontal and bottom. I tried:

android:gravity="bottom, center_horizontal"

This made an error. Appreciate the help and remember I am a beginner to Eclipse and Java.

Thanks in advance. – James

PS Help me build my rep please.

  • 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-05-16T11:02:02+00:00Added an answer on May 16, 2026 at 11:02 am

    You can use TextView & create a onClickListener to achieve the same easily:

                tv = (TextView) findViewById(R.id.tv);
                tv.setGravity(Gravity.CENTER);
    
                String title;
                Drawable icon; 
    
            tv.setText(title);
            tv.setCompoundDrawablesWithIntrinsicBounds(null, icon, null, null);
            tv.setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
    
                }
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want following layout in my app. A button at top, second botton at
I want to use selector for a layout and image view..But it is not
This is my code and I want the save image button to simply save
Currently I'm creating a button with Image and Text. My problem is I want
I want to create a Button otherthan creating it from xml layout.i want to
This is possible to disabled layout for few seconds? I want to layout shows
I want to have a grid type layout of image views. To begin i
I want to set wallpaper from viewpager(selected image). I have different pictures(R.drawable.a1,R.drawable.a2,R.drawable.a3,R.drawable.a4,R.drawable.a5,R.drawable.a6............) How can
I have one listview.which contain one image ,text and one button .i had creted
I have a layout problem, I want an image to be in the middle

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.