Reputation: 31
Here's my aching point. I'm new to android developoment and I want to create the splash screen to an app. presently, after searching in this forum, i found methods of implementing the splash screen from a picture but that's not what i want. I want the splash screen to be a color with a varying gradient. Attached to this question is a picture to illustrate what i mean. Unfortunately, couldn't paste an image due to my low reputation points. Nonetheless, here's a link to an gradient image. Further explaining, i want the color to be generated by either java or xml code dynamically so that, I won't have to bother about different screen sizes as all I'll have to do is to generate everything for full screen display. What's I'm trying to avoid is using picture assets if possible. Help Plz. Thanks
Upvotes: 1
Views: 9399
Reputation: 944
Also gradients and colors may be declared directly into splash.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<!--<color android:color="#2196F3"/>-->
<shape android:shape="rectangle">
<gradient
android:startColor="#2196F3"
android:endColor="#1976D2"
android:angle="-90"
/>
</shape>
</item>
<item>
<bitmap
android:src="@drawable/logo"
android:gravity="center"
/>
</item>
</layer-list>
Upvotes: 2
Reputation: 258
create a shape, add it to drawables like : <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@color/gradient_start" <!--this first color -->
android:endColor="@color/gradient_end" <!--this second color -->
android:angle="-270" /> <!--gradient angle -->
</shape>
and then on your splash.xml background, set background to the shape
add
<LinearLayout
android:id="@+id/ranking_order"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/list_grad"
/>
Upvotes: 12