开发者

setting a progressbar to be vertical

开发者 https://www.devze.com 2023-03-30 20:27 出处:网络
i\'ve an app that has a slidebar at the bottom of the screen. i\'m trying to make a 2nd one at the right edge of the screen. i\'ve looked at the relative layout params but can\'t find an attribute tha

i've an app that has a slidebar at the bottom of the screen. i'm trying to make a 2nd one at the right edge of the screen. i've looked at the relative layout params but can't find an attribute that makes the bar vertical. does anyone know how to achieve this?

<?xml version="1.0" encoding="utf-8" ?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="fill">

    <com.tecmark.TouchView
        android:id="@+id/touchview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />


    <com.tecmark.HorizontalSlider android:id="@+id/slider"
                android:indeterminateOnly="false"
                android:progressDrawable="@android:drawable/progress_horizontal"
                android:indeterminateDrawable="@android:drawable/progress_indeterminate_horizontal"
                android:minHeight="30dip"
                android:maxHeight="30dip" android:layout_width="fill_parent" 
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"/>

    <com.tecmark.HorizontalSlider android:id="@+id/slider2"
                android:indeterminateOnly="false"
                android:progressDrawable="@android:drawable/progress_horizontal"
               开发者_JAVA百科 android:indeterminateDrawable="@android:drawable/progress_indeterminate_horizontal"
                android:minHeight="30dip"
                android:maxHeight="30dip" android:layout_width="fill_parent" 
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"/>            
</RelativeLayout>


I don't think you are going to be able to do this with the ProgressBar widget provided as part of the system. You'd have to extend that and override the drawing methods to paint the thing vertically instead of horizontally. You can find the ProgressBar source code here. I don't have experience with anything like that but I think you'll be looking to modify the onDraw() method that is towards the bottom. Probably you'll want to change the values given to mProgressRect

0

精彩评论

暂无评论...
验证码 换一张
取 消