2

I'm having trouble labelling my button controls small letters from the first letter to the last. The first letter is always a capital letter? How can I change that? or should I make pictures on the ImageButton widget?

Aviwe
  • 29
  • 4

4 Answers4

1

For setting Image and label on the same control, you can use <Button> control of android.

For users who just want to put Background, Icon-Image and Text in one Button from different files: Set on a Button background, drawableTop/Bottom/Right/Left and padding attributes.

      <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/imagebackground"
        android:drawableTop="@drawable/imageonTop"
        android:textColor="#000000"
        android:id="@+id/btnwithImage"
        android:paddingTop="32sp"
        android:drawablePadding="-15sp"
        android:text="Your Label">
     </Button>

You can programmatically stop all letters to become capital by below code:

btnwithImage.setTransformationMethod(null);

and you can also use:

android:textAllCaps="false"

Hope it will help you.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
KishuDroid
  • 5,411
  • 4
  • 30
  • 47
0

you can add android:textAllCaps="false" to your button to make the button not capitalize every letter. (then set the text to however you want the capitalization : 'Button', 'button', 'BuTtOn', 'buttoN', etc.)


also to programmatically capitalize the first letter of a string (if that is what you are asking)

String yourString = "button label";
yourString = capitalize(yourString);

...

private String capitalize(final String line) {
   return Character.toUpperCase(line.charAt(0)) + line.substring(1);
}

from: https://stackoverflow.com/a/11149580

Community
  • 1
  • 1
mawalker
  • 2,072
  • 2
  • 22
  • 34
0

I don't know much about android since you are using jQuery so it can be done like this in jQuery

$('selector').css('text-transform','lowercase');

Note : selector can be a ID or class or tag_name

for e.x :

You have button like this

<button>Submit</button>

Then your jQuery will be

$('button').css('text-transform','lowercase');

This will apply style to all buttons tags...

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Amin Kodaganur
  • 646
  • 6
  • 19
0

It turns out that only on graphical layout does your font appear in capital letters when I ran it on the emmulator it was small letters as intended, thanx for your replies..!

Aviwe
  • 29
  • 4