I'm working on a new Android app designed in really flat style. I want to have a DialogAlert that shows up on a blurred background. Effect similiar to the control center on this photo (don't write about NDA, this photo is available on Apple's website):
Is it possible? If so, the most important question: how?
M.
Yes this is possible, You have to use something called renderscript.
so what you need is bitmap from the view this can be done using the following code.
View v // target view to be blurred
v.setDrawingCacheEnabled(true);
Bitmap screenshot = Bitmap.createBitmap(v.getDrawingCache());
Now use the renderscript to get the blurred bitmap shown here
http://blog.neteril.org/blog/2013/08/12/blurring-images-on-android/ and draw it to your view.
Yes it is possible. Instead of creating a Dialog, Create and Activity and In your Manifest add android:theme="#android:style/Theme.Dialog" to your activity like below:
<activity
android:name=".Activity"
android:label="#string/title_activity"
android:theme="#android:style/Theme.Dialog">
<intent-filter>
<action android:name="example.package" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
It can be done, but there's no quick and easy way to do it. Check our the BlurMask filter in the Android developer documentation or Android, how to blur/glass/frost current activity for some suggested steps.
Create the blurred bitmap in Photoshop and set it as the Activity/Dialog's background drawable.
Related
I've gone through quite a bit and I'm still at a loss for what I need to do:
http://developer.android.com/design/style/themes.html
http://developer.android.com/guide/topics/ui/themes.html
I have the view set to use the "Dialog" theme in my IDE (IntelliJ IDEA 14.1.2) and the application looks like this in the insepctor:
However looks completely different on my phone (Much larger resolution, but that's not the point).
What am I doing wrong and how can I get this effect?
i use this in one of my activities and it is ok:
<activity
android:name="eddine.charef.mechalikh.swipedemo.mapDialog"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
android:theme="#android:style/Theme.Dialog" ><!--add this-->
</activity>
maybe your android version doesn't support that.
Add to the Android Manifest
<activity
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"/>
I have an intent that makes a call and then the call event start; I want to set background layout for that Make_Calling screen
Can anyone help me?
"Set layout for this(Image) call make screen!!"
Thanks in Advance
Like the above(2nd) image...
Pretty much easy... In layout file there will be a LinearLayout or RelativeLayout or FrameLayout. use android:background attribute and pass drawable in it.
The layout xml has a attribute background. You can set in xml or do the same in code as well. android:background="#drawable/image.png"
You want to customize the default calling or incoming screen if I am right. It is not possible to customize the default screens. However, you will be able to replace the default screen with your own view. You can create an activity which calls your customised view and add the intent to the Activity in the Manifest file, similar to below
<activity class=".MyCustomCallActivity" android:label="#string/mycustomcall_title">
<intent-filter>
<action android:name="android.intent.action.ANSWER" />
</intent-filter>
</activity>
Read Intent for more details on how to handle intents
I hope that makes sense...
Basically when the on screen keyboard appears and then the auto suggestions as well, it pushes my view up the screen - a graphic in an imageView that I would like to persist.
When the auto complete is over and done with, the screen stays where is is despite the auto suggest disappearing.
Is there any way to let my layout reclaim that space and simply go back down again into the empty space ? ie to float back down again ?
Cheers :)
If I got you right, try adding the following line to the <activity> in your manifest:
<application
android:icon="#drawable/icon"
android:label="#string/app_name">
<activity
...
android:windowSoftInputMode="adjustPan"
...>
...
</activity>
...
</application>
I have an activity which should always be displayed in Landscape mode. So i added android:screenOrientation="landscape".
But the problem is when I rotate the device by 180 degrees, the display is inverted. is there a way to handle this issue so that the screen elements are always shown correctly.?
Actually what you really want is to specify:
android:screenOrientation="sensorLandscape"
in your AndroidManifest.xml. This will listen to the sensor data while snapping between landscape and reverseLandscape.
Others have mentioned sensorLandscape...to do this programmatically in your activity (or a base activity), you can set your orientation to that:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
I'm doing it in onResume(). This will respect landscape and reverse landscape when you flip the device around 180 degrees in the middle of the activity, without having to use onConfigurationChanged().
This was helpful to me since for tablets I need landscape/landscape reverse only, and for phones I need portrait/portrait reverse only, and don't want to do two separate AndroidManifest files. ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT also exists.
So just for everyone information, this is what i did.
In Android manifest added android:screenOrientation="landscape".
In on resume method add these lines of code
Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
int orientation = display.getRotation();
if(orientation==Surface.ROTATION_180)
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
}
This way my screen is always positioned correctly even if user holds the device upside down.
In the Android Manifest write this:
android:configChanges="orientation"
android:screenOrientation="landscape"
like in the example below.
<activity android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The good method is to use
setRequestedOrientation(6);
6 is the value for sensorLandscape but it seem's that there is no defined constant for it.
Hmmm. This depends a bit on the framework version you're using as well. Try this ast a start:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
If that works great. If it dosen't you have to tell us a little more about the layout of your app.
I have one activity and three intet filters, each with different label set on, (AndroidManifiest.xml below)
<activity android:name=".activities.RecordActivity">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="com.keitai.enigma.OPEN_RECORD" />
</intent-filter>
<intent-filter android:label="#string/newRecord">
<category android:name="android.intent.category.DEFAULT" />
<action android:name="com.keitai.enigma.NEW_RECORD" />
</intent-filter>
<intent-filter android:label="#string/editRecord">
<category android:name="android.intent.category.DEFAULT" />
<action android:name="com.keitai.enigma.EDIT_RECORD" />
</intent-filter>
</activity>
But activity title is not changing to label set in intent filter :( Activity always contains application label.
What I'm donig wrong?
Are you sure you don't have code that is setting the title explicitly?
Are you sure that the OPEN_RECORD intent isn't the one being triggered every time?
Have you tried debugging by making sure everything has a distinct label (application, activity, each intent-filter) and seeing what happens?
I agree with you that what you expected to happen is what the docs say should happen. But it seems like the default <application> label is being used regardless. I'm afraid if one of the above ideas doesn't help, then I'm out of ideas. I might try it myself later on my system to see if it happens for me.
http://developer.android.com/guide/topics/manifest/intent-filter-element.html#label
android:label
A user-readable label for the parent component. This label, rather than the one set by the parent component, is used when the component is presented to the user as having the capability described by the filter.
...
The default value is the label set by the parent component. If the parent does not specify a label, the default is the label set by the element's label attribute.
http://developer.android.com/guide/topics/manifest/manifest-intro.html#iconlabel
Icons and Labels
...
In every case, the icon and label set in a containing element become the default icon and label settings for all of the container's subelements. Thus, the icon and label set in the element are the default icon and label for each of the application's components. Similarly, the icon and label set for a component — for example, an element — are the default settings for each of the component's elements. If an element sets a label, but an activity and its intent filter do not, the application label is treated as the label for both the activity and the intent filter.
...
You use intents usually to pass information between activities, apps or services (just few examples).
My understanding is, that you want to change your title of one activity depending on e.g. if a button is pressed.
Therefore you need to set simply in your activity
this.setTitle("YOUR ACTIVITY NAME");
In case you want this to happen after a button click, put it into the listener of the corresponding button.
Actually, from your example I'd suggest that you use separate activities (which can specify labels that are shown as titles!).
In Android, one activity usually corresponds to one use case - so if OPEN_RECORD shows a dialog where the user can select a record and EDIT_RECORD allows to edit a record, than you would usually have two different activities.
Have a look at the notepad tutorial for an example.