2013年9月15日星期日

[Android] ProgressBar not help novice height on a line

android: id = "@ + id / down_pb"
style = "? android: attr / progressBarStyleHorizontal"
android: layout_width = "100dip"
android: layout_height = "8sp"
android: max = "100"
android: progress = "50"
android: minHeight = "10dip"
android: maxHeight = "10dip" />

how to change the height has been constant , that is, a line width , what progress can be changed
------ Solution --------------- -----------------------------
4.0 sounds like a line to . .
------ eference --------------------------------------- < br> I use the 3.0
------ eference ---------------------------------- -----
see online examples are style = "? android: attr / progressBarStyleHorizontal" the default height

or via android: layout_height = "8sp" directly set the height , but I can set up a useless

------ eference ------------------------------------ ---
I remember 2.0 time is yellow strip , after it becomes a gray blue
yellow when very wide , turned blue after a line like that . . Really did not notice how the height.
------ eference --------------------------------------- < br> the first now describes android4.1 system , ProgressBar into a line , for example, in the previous 2.3 system , set the ProgressBar properties are:
code

`` ` android: id = "@ + id/progressBar1" style = "? android: attr / progressBarStyleHorizontal"
android: layout_width = "240dp"
android: layout_height = "40dp"
android: layout_marginLeft = "20dp"
android: layout_marginTop = "20dp"
android: indeterminate = "false"
android: max = "100" />

above us by setting its width and height as well as the distance between the top and left it in the 2.3 system is entirely achievable . But in the 4.1 system, if only so that the result is only a thin line only, so the 4.1 system wants to set its height , methods need to re-set style style.xml file attributes ;

The first step is as follows Editors:

`` `style
code

`` `



Step two: refer to this style can be , style = "@ style / tallerBarStyle", as follows:

`` `java
code

`` ` android: id = "@ + id/progressBar1"
_ style = "@ style / tallerBarStyle" _
android: layout_width = "240dp"
android: layout_height = "40dp"
android: layout_marginLeft = "20dp"
android: layout_marginTop = "20dp"
android: indeterminate = "false"
android: max = "100"
/>



modified progress bar will become what we want it.

stressed :
ProgressBar default in 4.1 system is a line, if the style attribute to write style = "? android: attr / progressBarStyleHorizontal", even if set high , it can not change one line of the status quo.

没有评论:

发表评论