How do I set an Android ProgressBar's Size programmatically?

后端 未结 7 1639
盖世英雄少女心
盖世英雄少女心 2021-01-01 17:33

I have a custom view that extends ViewGroup. It includes a ProgressBar and a WebView. I\'m displaying the ProgressBar whi

相关标签:
7条回答
  • 2021-01-01 18:00

    Let's give it a try...

    I have fix the size of progressBar with add some padding.

    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <ProgressBar
                android:id="@+id/progressBar"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="45dp"
                />
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/category_img"
                android:scaleType="fitXY"
                tools:ignore="ContentDescription" />
        </RelativeLayout>
    

    Now Looks like this:

    0 讨论(0)
提交回复
热议问题