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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:32:58+00:00 2026-06-07T22:32:58+00:00

I have an ImageButton and want to scale the button in different sizes which

  • 0

I have an ImageButton and want to scale the button in different sizes which means an image is not the right choice. So I was thinking of an ImageButton with a custom Shape as source.

I want the button to look like this:

enter image description here

I started with this, but got stuck with the rotate stuff:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    
    <stroke
        android:width="2dp"
        android:color="@color/red" />
    <rotate
        android:fromDegrees="90"
        android:toDegrees="135" >
        <shape android:shape="line" >
            <stroke
                android:width="2dp"
                android:color="@color/red" >
            </stroke>
        </shape>
    </rotate>

    <padding
        android:bottom="7dp"
        android:left="7dp"
        android:right="7dp"
        android:top="7dp" />

</shape>

This however does not rotate as I expect it to. Maybe I am completely wrong and need a push in the right direction. 🙂 Thanks.

  • 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-07T22:33:01+00:00Added an answer on June 7, 2026 at 10:33 pm

    I got around that problem with a custom Button implementation and overwrite the onDraw() method which looks like this:

    @Override
    public void onDraw(Canvas canvas)
    {
        width = getMeasuredWidth();
        height = getMeasuredHeight();
    
        // diagonal top left | bottom right
        canvas.drawLine(0, 0, width, height, mPaint);
    
        // diagonal top right | bottom left
        canvas.drawLine(width, 0, 0, height, mPaint);
    
        // horizontal top
        canvas.drawLine(0, 0, width, 0, mPaint);
    
        // horizontal bottom
        canvas.drawLine(0, height, width, height, mPaint);
    
        // vertical left
        canvas.drawLine(0, 0, 0, height, mPaint);
    
        //vertical right
        canvas.drawLine(width, 0, width, height, mPaint);
    }
    

    You have to set mPaint yourself according to the color and size etc. you want your stroke.

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

Sidebar

Related Questions

I have a GalleryView which I want to add ImageButton to each image in
I want to make an ad banner. Right now i have an imagebutton that
In my application,I have 4 ImageButtons and each ImageButton have different source image based
I have an ImageButton: I want to make the image (circular play image) bigger.
I have follow this post to make ImageButton in android android image button The
I have asp:ImageButton in asp:table. I want to get the id of button in
I have a custom button class called ImageButton that extends JButton. In it i
I have an ImageButton and I want to show a text and an image
I have made a custom button bar as described here . Now, I want
I have an ImageButton which I want to change the NAME attribute of in

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.