Percentange horizontal bar in android -
i have 2 values difference of show colored horizontal bar in layout.
i have created:
horizontal bar 25 percent, 50 percent, 75 percent, 100 percent.
but when showing in linearlayout shows same wrapping image.
say example:
i have total 100 / have got mark of 50: difference 50% want color horizontal linearlayout 50%
how can it? can suggest easy way other image idea above?
thanks!
assuming understand question correctly, have operation want show progress of, in 25% increments. easiest way accomplish use progressbar. barring using progressbar, if want forge ahead using current design (which not recommend, progressbar class designed seems trying do), set these 4 bars in linearlayout horizontal orientation:
<linearlayout android:layout_height="wrap_content" //or whatever height need android:layout_width="match_parent" //or whatever need android:orientation="horizontal" > <com.yourpackage.horizontalbar android:id="@+id/bar1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:visibility="invisible"/> <com.yourpackage.horizontalbar android:id="@+id/bar2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:visibility="invisible"/> <com.yourpackage.horizontalbar android:id="@+id/bar3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:visibility="invisible"/> <com.yourpackage.horizontalbar android:id="@+id/bar4" android:layout_height="wrap_content" android:layout_width="wrap_content" android:visibility="invisible"/> </linearlayout>
and in activity
assume have kind of onupdate listener
in change visibility of each bar visibile
.setvisibility(view.visible)
.
hope answers question.
Comments
Post a Comment