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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:01:19+00:00 2026-05-26T23:01:19+00:00

I want you to direct me to good links or give me the basic

  • 0

I want you to direct me to good links or give me the basic elements that I have to study and read about to be able to build a custom user interface in android.
What I mean by custom is that the interface will contain buttons that are images not a regular android button.
Also I have to generate custom buttons on the fly based on user action and those generated buttons should have events associated with them.

  • 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-26T23:01:19+00:00Added an answer on May 26, 2026 at 11:01 pm

    Generic info about buttons here

    To use image for a button you need an android.widget.ImageButton. Example of drawable selector (put it in res/drawable/):

    <selector xmlns:android="http://schemas.android.com/apk/res/android">
         <item android:state_pressed="true"
               android:drawable="@drawable/button_pressed" /> <!-- pressed -->
         <item android:state_focused="true"
               android:drawable="@drawable/button_focused" /> <!-- focused -->
         <item android:drawable="@drawable/button_normal" /> <!-- default -->
     </selector>
    

    So you can use different images for various states.
    To generate buttons on the fly you can define base layout with any layout manager (FrameLayout, RelativeLayout, LinearLayout), find it by id (findViewById()) within your Activity and make it visible:

    public void createContainerForImageView() { 
        LinearLayout container = new LinearLayout(this);  
        container.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); 
        container.setOrientation(LinearLayout.HORIZONTAL); 
    
        ImageView img=(ImageView)findViewById(R.id.ImageView01);
        Bitmap bmp=BitmapFactory.decodeResource(getResources(), R.drawable.sc01);
        int width=200;
        int height=200;
        Bitmap resizedbitmap=Bitmap.createScaledBitmap(bmp, width, height, true);    
        img.setImageBitmap(resizedbitmap);
    
        container.addView(img); // or you can set the visibility of the img
    }
    

    Hope this helps.

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

Sidebar

Related Questions

I have a file with .php extention www.example.com/thefile.php?name=123 that I want to direct the
I have a checkbox that I do not want the user to have direct
I have a Netflix Affiliate account, but I don't want to direct users to
I have a form, when user submit the form, I want to direct the
I have a folder for downloads on my server, i want to prevent direct
Let's say I have a website that displays info about books. The info about
I want to have pretty and SEO oriented URLs in my site. I've build
Let's assume I have an unlimited hosting plan on GoDaddy that I want to
Instead fo displaying in alert box I want to direct my output from javascript
in linux, let say i want to start tomcat, and want to direct all

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.