ProgressBar within a drawable

2

With the help of a post from a user here, how to remove the white screen from the "pre-load" before splahScreen I solved the problem, now I would like to know if in this drawable a progressbar can be integrated. I leave the drawable below ...

    <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:opacity="opaque">
    <item android:drawable="@color/colorPrimaryDark"/>
    <item android:top="-48dp">
        <bitmap
            android:gravity="center"
            android:src="@drawable/ic_momento"
            />
    </item>
</layer-list>

I would like to change a progresbar to the image that is loading or in the last case to be able to assign a size to the image. Any ideas?

    
asked by Ashley G. 14.02.2017 в 23:54
source

1 answer

1

Integrating a ProgressBar to a drawable is not possible, you can display the image in a ImageView and the ProgressBar would be a view that would be above the ImageView .

In the case of the SplashScreen, the common thing is to create a theme which you will relate to the activity:

 <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@drawable/ic_momento</item>
   </style>

This Activity will load a layout, this is where you would add your ProgressBar :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/linlaHeaderProgress"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ProgressBar
        android:id="@+id/myProgress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center">
    </ProgressBar>   
</LinearLayout>
    
answered by 15.02.2017 / 05:11
source