How to make half screen for notification activity in android - android

I have develop an application that have some function on Call, so i want to make notification screen for it and display Contact Image, Number and Call duration, so i want implement like true Caller screen(Half activity)
so i am confuse about how to develop code for half Activity so suggest me code
Like this image

Try this..
Add the below code into your styles.xml that's inside values folder
<style name="Theme.D1NoTitleDim" parent="android:style/Theme.Translucent">
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:background">#android:color/transparent</item>
</style>
then design like that kind of layout and for your activity in AndroidManifest.xml
<activity
android:name=".YourNotificationActivity"
android:theme="#style/Theme.D1NoTitleDim" >

Related

Making android:windowBackground as #null by overriding the theme makes the view to repeat

I recently moved one of my activities(starting with a blank activity in Android Studio) to a full screen activity. Earlier, my activity looked like this.
I have few custom views inside my layout. To make my activity full screen, I just created a new full screen activity using the option in Android Studio and copied my code to the new activity. I noticed that the newly created full screen activity generated a theme overriding the application theme and then assigns this theme to the activity. The generated theme is as follows:
<style name="FullscreenTheme" parent="MyDefaultTheme">
<item name="android:actionBarStyle">#style/FullscreenActionBarStyle</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowBackground">#null</item>
<item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
<item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
</style>
<style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
<item name="android:background">#color/black_overlay</item>
</style>
The problem I face is that the item
<item name="android:windowBackground">#null</item>
causes the activity view to be rendered like this:
If I comment that line in the new theme (or give it a color), everything seems to be working fine. I read few articles like this to understand this but I am still not clear what is happening in my case. Any explanations for this issue?
Also, I do not see any utility of
<style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
<item name="android:background">#color/colorBackgroundLT</item>
</style>
Can anybody explain this as well?

How to get Transparent android activity over the lockscreen?

I want my activity to show up on lockscreen(which is working fine). but i want to get that activity transparent..
I tried 2 methods both are not allowing my activity to show on lockscreen.
Method 1
android:theme="#android:style/Theme.Translucent.NoTitleBar"
Method 2
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
Both are not allowing to show the activity on lockscreen.
Is there any method you know?
Try setting following codes in your activity.I have not tried it, it may work.
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
This is because you defined windowIsFloating to be true. An activity won't show in front of a lockscreen if the width or height are modified, or if it is set to be floating.
You should set windowIsFloating to false, windowBackground to transparent and if you would still like the dialog-effect, create a dialogfragment, and show that in your onCreate of the activity. And of course, remove the ActionBar from the activity:
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>

Transparent Android activity trouble

I have an application where the theme can be changed between three different ones. I have two activities that are supposed to have a transparent background and look like a dialog above the previous activity.
I've searched alot for transparent activities here on stack and most of them have the same awnsers. A custom theme with a few properties to enable a transparent background for the activity in question.
The issue for me is that i need to set this custom transparent theme on the parent activity as well to achieve any transparency at all. If i only set a transparent theme on the activity i want to be transparent, it will be a solid background. I've tried everything i could think of but it all boils down to this and im not sure what im doing wrong.
This is my two different parent themes (slimmed down to the neccesary parts):
<style name="StyledActionbar" parent="Theme.Sherlock.Light.ForceOverflow">
<item name="android:textViewStyle">#style/Iksu.TextView</item>
<item name="windowContentOverlay">#null</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<style name="Transparent" parent="Theme.Sherlock.Light.ForceOverflow">
<item name="android:textViewStyle">#style/TextView</item>
<item name="windowContentOverlay">#null</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsTranslucent">true</item>
</style>
StyledActionBar is the parent for my three different main themes that is used for all activities that are not supposed to have a transparent background (which is all but two).
Transparent is the parent for three themes that can be used on an activity where the background needs to be transparent.
So the parent activity has a theme based on the StyledActionBar theme. The activity i need to have transparent is based on the Transparent theme.
The background is solid in this state.
If i move:
<item name="android:windowIsTranslucent">true</item>
to StyledActionBar, almost everything works as a charm except a nasty bug in Android 4.4.2 causing the main activity to "fall behind" the OS view when using NavUtils for up-navigation to the main activity.
Any ideas?
in your manigest file
<activity
android:theme="#android:style/Theme.Translucent.NoTitleBar">
</activity>
and in your xml set
android:background="#android/transperent"
also you can use
android:alpha="0.50"
try this one more time :
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
and in the manifest file
<activity android:name=".AlertActivity"
android:theme="#style/Theme.Transparent"/>
Hope it will work for u.

how to create custom UI like evernote help in android

I am trying to crate a Custom UI similar to evernote help android app. As I understand, to start with I have to first create a custom Textview But i cant create a black filter.
I want make new help activity(or draw a view) above the original activity like above image.
My layout has an image and text overlay on it. I know it is a basic question, but I am facing this issue, as I am a beginner to android development. Please do help me to understand how to go with this.
sorry for my bad english.
To make the help activity transprent first make a transprent theme in the styles.xml file in valuse folded using
<style name="AppTheme" parent="android:Theme.Light" />
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
then make in the manifest file make this as the theme of your help activty
<activity
android:name=".Help"
android:theme="#style/Theme.Transparent"
android:screenOrientation="portrait"></activity>
now in the help activty will be displayed over your prvious activity.

Why there is a white screen appears for 1sec when starting to run the apps in Android?

When I click the app icons and start to run the apps, it will appear a white screen for 1 sec.
I don't know why.
Is there any idea to clear this white screen and directly go to my activity?
The white/black screen is the window background image.
The window background is shown while e.g. your onCreate() runs and your layouts are being inflated. It can take some time especially if there's a lot of bitmaps that need to be read, decoded and scaled.
Changing the theme works because some themes have a non-default window background. For example, Theme.Wallpaper has a transparent background. There are other definitions there, too. Essentially what you want is:
<style name="YourTheme">
<item name="android:windowBackground">#null</item>
</style>
Programmatically you can achieve the same with
getWindow().setBackgroundDrawable(null);
at the top of activity onCreate().
(Old question but got bumped up by another answer and there wasn't a good answer.)
Settings. File>Settings>Build,Deployment>Instant Run Deselect all options shown there.
and add below line in your style.xml
<item name="android:windowDisablePreview">true</item>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowDisablePreview">true</item>
</style>
apply changes in AndroidMainfest.xml
<application
android:theme="#style/AppTheme">
After I change style.xml:
<resources>
<style name="AppTheme" parent="android:Theme.Wallpaper" />
</resources>
it works!!
Thanks all
Add the following in the manifest file of the corresponding activity
android:launchMode="standard"
and remove android:label="#string/app_name" from the corresponding activity ,this actually helped me
In your manifest.xml file remove the line android:theme="#style/AppTheme" for your app. and check it again
Use this tag in your manifest:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
In Styles add the following things
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsTranslucent">true</item>
Hope this will help you and its working for me

Categories

Resources