Android Question How to make a button the way they often are

Discussion in 'Android Questions' started by Martincg, Jan 16, 2015.

  1. Martincg

    Martincg Member Licensed User

    I am defeated by simple buttons!

    If I place a button on a panel and make the top 0 and the left 0 then there is always a border around the button showing the parent panel which I don't want.
    I can use a label but labels don't seem to respond to touch so that I cannot change the colour when it's pressed, although I can use a click event.

    Panels behave the way I want but they don't have a text field.

    So I'm using a panel, then a label, then a transparent panel over the label and I can respond the the panel touch, change the label colour on ACTION_DOWN/ACTION_UP and treat up or down as click.
    I find it difficult to believe this is what everyone does.

    How should I do it and what am I missing?
  2. NJDude

    NJDude Expert Licensed User

    That's how buttons are supposed to be, if you just want flat buttons then use StateListDrawable.
    thedesolatesoul likes this.
  3. Martincg

    Martincg Member Licensed User


    I don't know what statelistdrawable is yet, but don't tell me, I want to find out myself - it's better for my learning.


    I see, it's obvious of course. Ah well, at least I'm not so stupid now as I was 10 minutes ago.
    Last edited: Jan 17, 2015
  4. thedesolatesoul

    thedesolatesoul Expert Licensed User

    If you use SLD you can detect click on labels and panels and buttons and anything.
    NJDude likes this.
  5. mrjaw

    mrjaw Active Member Licensed User

    I need to do a circle button with a picture, how can i do?
  6. DonManfred

    DonManfred Expert Licensed User

    Better start a OWN thread for your issue instead of hijacking other threads which has nothing in common with your issue.
    You can also USE the forum search: Search the forum!
    Last edited: Jan 17, 2015
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice