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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:01:28+00:00 2026-05-23T07:01:28+00:00

I have created a button in my screen’s XML like this: <Button android:text=Lets Get

  • 0

I have created a button in my screen’s XML like this:

   <Button android:text="Lets Get Started"        

          android:background="@drawable/btnbg"  
          android:id="@+id/btn_nav_let_strtd"android:layout_width="wrap_content" 
           android:layout_height="35px" 
           android:textColor="#FFFFFF"
           android:layout_alignParentLeft="true"
           android:drawableRight="@drawable/arrow"
           android:drawableLeft="@drawable/nav_getstart">
           </Button>
</LinearLayout>

set click listenrss

private LinearLayout ll_get_started;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.navigation);
btn_nav_lets_get_strtd = (Button) findViewById(R.id.btn_nav_let_strtd); 

btn_nav_lets_get_strtd.setClickable(true);

}
private void setOnclickListeners() {
btn_nav_lets_get_strtd.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
    System.out.println("clicked");
    Toast.makeText(NavigationScreen.this, "fgd",Toast.LENGTH_SHORT).show();
    }
});

But when I try to click this button, it is neither clickable nor focusable. How do I set it as clickable?

I am now using a statelist drawable, but it sets the background when focused or clicked. I want to set a permanent background to this button.

And the drawable is not a bitmap, it is a statlist drawable btnbg. XML is below:

    <selector xmlns:android="http://schemas.android.com/apk/res/android"
    android:constantSize="true"
    android:dither="true"
    android:variablePadding="true" >
    <item
    android:drawable="@drawable/nav_blue_bar"
    android:state_pressed="true"
    />
  • 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-23T07:01:29+00:00Added an answer on May 23, 2026 at 7:01 am

    you should add a listener to listen the clic event on your button like this :

    Button btn = (Button)findViewById(R.id.btn1);
    
    //add the listener to your Button 
    btn.addOnClickListener( new OnClickListener(){
        @Override
        public void onClick(View v ){
    
            Toast.makeText(YourActivity.this, "the button is clicked ...", 3000).show();
    
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

there i have created a program with a tab button and page number. all
I have created an item swapper control consisting in two listboxes and some buttons
I have code to create another row (div with inputs) on a button click.
I've deconstructed a standard WPF button using Blend and have managed to create a
I have a button on a website that creates a directory and copys a
I'm trying to create a custom control - a button - which will have
How can I create in a Swing interface a toggle image button? I have
Have created a c++ implementation of the Hough transform for detecting lines in images.
I have created a template for Visual Studio 2008 and it currently shows up
I have created a custom dialog for Visual Studio Setup Project using the steps

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.