0

I was wondering how you can create buttons like the ones at the bottom of the screen and the home button at the top?

enter image description here

2 Answers 2

4

Quite hard to understand if you have doubts about button design and states or button position. If it's a design issue, you should create your button states on your favorite software, as example, photoshop. Then, in your android layouts you point your button background src to a drawable XML containing all button states.

Example XML for button:

    <Button android:id="@+id/back"
            android:layout_width="184px" android:layout_height="44px"
            android:background="@+drawable/back" />

After this, you need your custom picture for the button, and the button XML on your drawables folder, here's the XML you need for your button:

    <?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/button_pressed" /> <!-- pressed -->
     <item android:state_focused="true"
           android:drawable="@drawable/button_focused" /> <!-- focused -->
     <item android:drawable="@drawable/button_normal" /> <!-- default -->
 </selector>

Follow up on: http://developer.android.com/reference/android/widget/ImageButton.html

Sign up to request clarification or add additional context in comments.

1 Comment

This is actually the right answer. Don't know why the op didn't mark this one.
2

The title bar you mentioned about is called "Action Bar"

You can learn how to implement it here:

Regards.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.