Splashscreen issue with full height display - android

I am having an issue with viewing my splashscreen as per the design.It shows an incomplete vertical view but a complete horizontal view.
Here is the splashscreen design:
Here is what I get as display when added to my project:
I am using two images as bitmap and combining them.
Below is my splashscreen.xml file:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap
android:gravity="fill_horizontal|fill_vertical"
android:src="#drawable/ic_splash_screen_bg_xx"/>
</item>
</layer-list>
I tried setting android:gravity value in my splashscreen.xml to:
android:gravity="fill_horizontal|fill_vertical" yet I still get same incomplete vertical display

You can use SplashScreenAPI introduce in android 12.

Related

How to have multi-layered kind of shadow/gradient in Android

I am trying to achieve this layout. The upper part is a bit dark and it decreases as we move down making it complete transparent. I tried a couple of gradient variations but didn't get the desired results. Does anybody have idea of how to achieve this. Is it gradient or shadow ?
Create a gradient file and use this code you can increase or decrease transparency as you want
layout-->new file-->layout resource file--> give any name
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient android:startColor="#B71A1A1A"
android:angle="270"
android:centerColor="#00FFFFFF"
android:endColor="#00FFFFFF"/>
</shape>
</item>
</selector>

How to implement circular menu in android

I started customizing circular widget on my android application. i got something similar to my requirements by converting recycler view into a curved shape. but the problem is multiple layers are overlapping each other. how to make layers independently clickable. please help me out. Thanks in advance.
look at this This is how recycler views are overlapping each other
the expected design looks like this
Use this in your drawable file. it will be make right curve.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#color/colorPrimary" />
<corners android:topRightRadius="150dp" />
</shape>

Android - Bitmap Scale [QS Panel Background]

First of all ... I apologize for my English.
I am trying to add a background to the notification panel, the issue is that I have already achieved it by modifying the file qs_background_primary.xml located in SystemUI/res/drawable
This is the code I am using:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="#android:color/black"/> <!-- the image is very small, so add a black background -->
<item>
<bitmap android:scaleType="fitXY" android:src="#drawable/background_bg" android:gravity="center|bottom|clip_vertical" xmlns:android="http://schemas.android.com/apk/res/android" />
</item>
</layer-list>
Once the background with image and compilation is ready, one problem bothers me and it is that when I slide the navigation bar the image looks horribly, as if the size started from 0 to its original size once it was completely slid.
This is what the size looks like:
This is what the full size looks like:

Layout-list bitmap specific size

I have a problem while trying to implement a layer-list xml file in which I just want to be a gray background with an image in the middle. The problem is that I want to fix the center image to 200dp (width and height). How can it be achieved? I have found that the only way is to use the paddings, but this does not allow me to fix the image to 200dp, independently of the screen... Is it possible to achieve?
Thank you,
The code:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="#color/gray_dark"/>
<item>
<bitmap
android:gravity="center"
android:src="#drawable/ic_launcher_rounded"/>
</item>
</layer-list>
Note:
The purpose is to use it as a theme's background in order to simulate a splash-screen (If done as an activity layout takes more time and does not look like a real splash-screen)
This is an old question, but maybe someone will find this answer useful.
To specify bitmap size, you can use this xml.
<?xml version="1.0" encoding="UTF-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
android:drawable="#color/gray_dark"/>
</item>
<item
android:height="500px"
android:width="500px"
android:gravity="center">
<bitmap
android:src="#drawable/ic_launcher_rounded"/>
android:gravity="fill"/>
</item>
</layer-list>

Why Android layer-list drawable so intelligent?

I can't dig deep into how android implements its layer-list drawable. But I find it interesting and I can hardly know why this happens.
Here are some drawables:
the nine-patch xml
<?xml version="1.0" encoding="utf-8"?>
<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/cam2tst_ripple_bg_img">
</nine-patch>
the shape xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<padding
android:left="#dimen/cam2tst_ripple_horizontal_padding"
android:top="#dimen/cam2tst_ripple_vertical_padding"
android:right="#dimen/cam2tst_ripple_horizontal_padding"
android:bottom="#dimen/cam2tst_ripple_vertical_padding" />
<solid android:color="#android:color/holo_green_dark" />
</shape>
the ripple xml
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#android:color/holo_green_light">
<item android:drawable="#drawable/cam2tst_ripple_shape"></item>
</ripple>
the layer-list containing all above
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#drawable/cam2tst_ripple_bg_img" />
<item android:drawable="#drawable/cam2tst_ripple_base" />
</layer-list>
Unfortainately I still can't get my screenshot thing work on my L preview, but I can describe it.
What I get is the shape (which i obviously didn't set its size explicitly) doesn't cover over the whole nine-patch! The un-streched part of the nine-patch is magically considered as some kind of "auto padding thing". What I was expecting (ok I was expecting exactly what android has done for me, I mean what I was... supposing...) is something not so positive: the not-particularly-sized shape drawable covering the entire nine-patch just as if the latter is a normal png.
But the shape does magically avoid the un-stretched part of the nine-patch and overlays only above the streched-part of the nine-patch.
This is awesome...but confusing, why? I may not able to dig that deep into the source but this do sounds anti-intuition (but nice). I want to know the reason though. So I post this here.
Since I tagged this as android-L because I am working on one. But I think this shall be working from something like gingerbread.(just to replace the ripple drawable with something else, maybe a inset drawable etc.)
This effect is caused by the combination of two things:
All nine-patch drawables have a padding area defined automatically from the edges of the content area. The content area can be defined either explicitly, using the right and bottom lines at the border, or implicitly from the stretchable area defined by the left and top lines.
Layer-list applies the padding on each layer cumulatively to the next layer by default*, effectively treating each layer as the content of the previous layer.
* Lollipop has introduced a new attribute for disabling this behavior.

Categories

Resources