android - Horizontal Single Bar Graph with Two color representation -
what easiest way create horizontal single bar graph in android 2 colors representations? this
the amount 64% increased 100% timely manner (animation??? :( ) svg or image views or how?
this layout achieves above, adjust p3 textview width (red background) in code percentage of p1 textview width (blue background) changing p4 textview text current percentage (consider percentage reaches 100% labels overlap, suggest setting text value on p3 after limit, 85%, , hiding p4. suggest using asynctask (or other threading method) if increasing percentage incrementally see ui updates. @ android tween animation.
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="50dp" android:orientation="horizontal" android:padding="5dp"> <textview android:id="@+id/bar" android:layout_width="5dp" android:layout_height="25dp" android:background="#ff000000" /> <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingtop="5dp"> <textview android:id="@+id/p1" android:layout_width="220dp" android:layout_height="wrap_content" android:background="#ff00ffff" /> <textview android:id="@+id/p2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_torightof="@+id/p1" android:text="100%" /> <textview android:id="@+id/p3" android:layout_width="140dp" android:layout_height="wrap_content" android:background="#ffff0000" android:gravity="end" /> <textview android:id="@+id/p4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_torightof="@+id/p3" android:text="64%" /> </relativelayout> </linearlayout>
Comments
Post a Comment