Progress bar with image in center

前端 未结 1 1522
再見小時候
再見小時候 2021-01-12 17:07

Hi guys today i\'am trying to do my custom progress bar, for that i created a spinner_inner and a spinner_outer, but my inner size is to large and overlaps the outer.

<
相关标签:
1条回答
  • 2021-01-12 17:30

    So after nobody answer me i find my own way.

    The layout:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/loading_status"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    android:visibility="gone" >
    
    <RelativeLayout
        android:id="@+id/relative_container"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
    
        <ImageView
            android:id="@+id/image_test"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:src="@drawable/spinner_inner"
            android:layout_centerInParent="true" />
    
        <ProgressBar
            android:id="@+id/progress"
            style="?android:attr/progressBarStyleLarge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:indeterminateDrawable="@drawable/loading"
            android:visibility="visible" />
    </RelativeLayout>
    
    <TextView
        android:id="@+id/status_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:fontFamily="sans-serif-light"
        android:text="@string/loading_data"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    

    The out spinner

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    
        <item>
            <rotate
                android:fromDegrees="0"
                android:interpolator="@android:anim/linear_interpolator"
                android:pivotX="50%"
                android:pivotY="50%"
                android:toDegrees="360" >
                <bitmap
                    android:antialias="true"
                    android:filter="true"
                    android:src="@drawable/spinner_outer" />
            </rotate>
        </item>
    
    </layer-list>
    
    0 讨论(0)
提交回复
热议问题