RSS

Tag Archives: style

Android: Change ProgressBar height


In Android development, you might dislike the very thin progress bar that Android defaults. For instance, in the below xml file, though you can specify the width and height, but you can see that width value functions, but the height value, no matter how large you specify, it remains slim horizontal bar:

image

image

image

To get the height value right, it is very simple:

change style=”?android:attr/progressBarStyleHorizontal” to
     
 style="@android:style/Widget.ProgressBar.Horizontal"

That is it! Happy coding!

Advertisements
 
4 Comments

Posted by on August 19, 2014 in Android, Java, Programming

 

Tags: , , , , , , , ,

Android EditText control: using old rectangle style


The latest android EditText looks like this (below left:

image   image

But I was asked to use old-style rectangle style (above right) to replace the current one. Here is how it is done:

  • Create a new xml file in res/drawable folder, which looks like this:

image

  • Next, in your activity’s layout xml file, append below 1-line code:

image

Note I: you don’t have to create the above xml file, and you can download this 14-line rect_tex_edit.xml file and directly put it in your project’s res/drawable/ folder.

Note II : the below code might be useful, which makes the cursor and text more legible and clear in the view:

android:textColor=”@android:color/black”
android:textCursorDrawable=”@null”

That is it. Enjoy this trick!

 
5 Comments

Posted by on August 26, 2013 in Android, Java, Programming

 

Tags: , , , ,