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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:40:20+00:00 2026-05-27T20:40:20+00:00

btw i am just learning so bear with me ive got all my code

  • 0

btw i am just learning so bear with me ive got all my code correct as far as i can tell my main.xml reads

<Button
 android:id="@+id/LOGIN"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="@string/LOGIN"
 android:textSize="25dp"
 android:background="@drawable/custombutton"/>

custombutton.xml

<item
android:state_pressed="true"
android:drawable="@drawable/musicnotes1"/>
<item
android:state_focused="true"
android:drawable="@drawable/musicnotes2"/>

created a custombutton.java

import android.app.Activity;
import android.os.Bundle;

public class custombutton extends Activity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.drawable.custombutton);
    }
}

and I have the android manifest correct as well no errors showing why is my button gone?

  • 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-27T20:40:21+00:00Added an answer on May 27, 2026 at 8:40 pm

    You are setting your content view to be R.drawable.custombutton when it should be R.layout.main

    For example:

    setContentView(R.drawable.custombutton);
    

    should be:

    setContentView(R.layout.main);
    

    Also, you posted your main.xml source but be sure that your button is inside of a layout.

    For example:

    <?xml version="1.0" encoding="UTF-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    
        <Button
            android:id="@+id/LOGIN"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/LOGIN"
            android:textSize="25dp"
            android:background="@drawable/custombutton"/>
    
    </LinearLayout>
    

    And your background drawable selector should be wrap in a selector like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item
            android:state_pressed="true"
            android:drawable="@drawable/musicnotes1" 
        />
        <item
            android:state_focused="true"
            android:drawable="@drawable/musicnotes2" 
        />
        <item
            android:drawable="@drawable/default" 
        />
    </selector>
    

    Perhaps you are forgetting to have a default image?

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

Sidebar

Related Questions

I went to all the documentation, also I went to the IRC channel (BTW
Just started learning Rails (3). I am tearing my hair out trying to find
I write some code to learning F#. Here is a example: let nextPrime list=
I've just started learning about extending the Configuration file structure by creating custom section
I'm just fooling around, learning the ins and outs of web development and I'd
I just installed Eclipse at home, so I can program servlets. But it seems
its already past 2nd June ! Btw I just want to know is it
Hey everyone. I am an experienced java programmer and am just learning C++. Now
I just started learning using AJAX with Codeigniter. On my view, I have a
I just installed Visual Studio C++ 2010 Express (BTW. great ide). I have to

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.