emeraldhieu
emeraldhieu

Reputation: 9439

Create small button

My intent is to create many buttons in a line so I think each button must be small.

How to create small button like this?
what I want

I tried the below code but it is not similar.
what I get

This is my style.xml

<style name="RightLink2" parent="@android:style/Widget.Button.Small">  
  <item name="android:layout_height">wrap_content</item>
  <item name="android:layout_width">wrap_content</item>
  <item name="android:padding">2dip</item>  
  <item name="android:textSize">10dp</item>
</style>

this is my layout.xml

<LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:orientation="horizontal" android:layout_height="wrap_content" android:weightSum="1">
    <Button android:id="@+id/myButton"        
    style="@style/RightLink2"
    android:text="Click here"/>        
</LinearLayout>

Upvotes: 1

Views: 7253

Answers (2)

Android Boy
Android Boy

Reputation: 4345

This is not fair in user point up view.

Because, When user want to be press on one button then would be pressed two button at once time. You can do this, But it not a usable thing...!!!

Upvotes: 1

Kheldar
Kheldar

Reputation: 5389

If you intend to do many small buttons in a line, you are doing it wrong.

You are in effect, when programming for a phone, a UI designer. You have to remember your user will use his big fat greasy fingers while eating a hamburger and drinking soda, potentially, and still has to navigate your application easily.

There are guidelines about the minimal recommended size for a button, but you should use the following idea:

  • if you have more than 5 buttons on your line, you're doing it wrong
  • if you still want to put more than five buttons, you can either have one of the five buttons that opens a button pane/view, or slide the button line horizontally to reveal other buttons.

Both ways work, but I favor the second that i find both sexier and more usable. You will probably need a small indicator (as a triangle or equivalent) on the side to show there is more. Discoverability is important, and users are trained nowadays to try to slide stuff.

Upvotes: 8

Related Questions