My app preview image looks like this:
How can I make it look like the WhatsApp Chat preview, small with shadow. Also other apps in my phone use the same type of preview.
My widget xml:
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="#layout/appwidget"
android:minHeight="40dp"
android:minWidth="320dp"
android:previewImage="#mipmap/ic_launcher"
android:updatePeriodMillis="300000" >
</appwidget-provider>
Manifest:
<receiver
android:name=".activities.MyWidgetProvider"
android:label="Example Widget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget_info" />
</receiver>
UPDATE:
Actually I have noticed this all shortcuts and not widgets, they all have this look.
You have set your launcher icon as widget preview image.
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
...
android:previewImage="#drawable/widget_preview">
</appwidget-provider>
I suggest you to make a screenshot of your widget with the emulator, which has an application (Widget Preview) for creating a preview with just the right size.
Then, you can also edit the picture if you are not satisfied.
Anyway, be sure to put it on drawable-nodpi.
Official guide to follow: https://developer.android.com/guide/topics/appwidgets/index.html#preview
For other dev experience, see this link: Android Widget: previewImage size
It seems that you have placed ic_launcher as widget previewImage
You have to make a custom image, which have large image as Alpha in background, and on it place your icon in small size on top-right corner.
I have done same thing by generating custom image for previewImage with help of photoshop and its working.
Thank you.
Related
I am stuck in very strange problem.
I am using a background image for my application. Up till now everything is smooth and normal but all of sudden My image appears fade in new devices for example moto G4+ and Moto G5+. But working normal on my coolpad and samsung 4x devices.
Below is normal image.
And below is image when it use it as background image.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sdl.apps.yaarri.views.fakeActivity">
<RelativeLayout
android:id="#+id/fakeid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background"
></RelativeLayout>
</android.support.constraint.ConstraintLayout>
This is simplest of xml I am creating.
One thing I want to mention that after implementing Account kit(Facebook)for login this thing appears to happen.
If I am using some simple image then it appears normal but with this image problem occurs. Please suggest me I am am doing some thing wrong or it is some memory issue.
On more thing I want to mention here is that when I close application and open it again,nothing changes fade issue remains. But when I clear app from recently opened applications list and then open my app then original image appears as background.
I have found out the issue.
The problem was with Facebook theme.
My code to set account kit
uiManager = new SkinManager(
SkinManager.Skin.TRANSLUCENT,
getResources().getColor(R.color.apptheme_color),
R.drawable.background,
SkinManager.Tint.WHITE,
0.01)
and in manifest it was like:-
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
tools:replace="android:theme" />
So this was replacing app theme and setting its own image as background and with fade(transulent) effect.
What I did? Just remove the backkground image part in UImanager.
uiManager = new SkinManager(
SkinManager.Skin.CONTEMPORARY,
getResources().getColor(R.color.apptheme_color));
This will show white facebook login page but wont effect app theme.
Hope ,no body will face this...Namaste
I had a problem before with appearance of background images in some devices.
Then, I find that it depends to the screen mode of the device. See here how change screen mode: https://www.youtube.com/watch?v=2UoxvkwsiJ8
and check if this is the cause of your issue or not.
Actually I am working on music player widgets, I made home widget for music player and it is working fine,but when I play any song I need to show that song image on android lock scren, I tried lockscreen widget but I didn't get it please help me
Home widget:
<receiver android:name=".widgets.HomeWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/app_widget_provider"/>
</receiver>
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="#layout/home_widget_layout"
android:minHeight="10dp"
android:minWidth="250dp"
android:updatePeriodMillis="1000000"
>
</appwidget-provider>
If you want to enable your widgets in lockscreen too you have to set widgetcategory to keygaurd in your manifest as:
<android:widgetCategory="keyguard|home_screen">
You can find detailed documentation in: http://developer.android.com/guide/topics/appwidgets/index.html#lockscreen
Actually Google did away with lock screen widgets in Android 5.0 (Lollipop). If you simply want to display the album art on the lock screen, then let your app implement RemoteControlClient (or MediaSession for API 21 and up)
If you want more functionality, the you can create you own interactive lock screen experience for your users with the Adenda SDK (I'm affiliated with Adenda for full disclosure)
I've defined an upload_widget.png file for my app widget, and declared it as below in my AndroidManifest.xml. It worked fine when I first created it, but I've now made a change to the .png image files (in each of /drawable folders), synchronised the files in Android Studio, but the widget icon is not reflecting the new .png files when I re-test the app on my Galaxy S4.
When I long-press on the screen (I'm using Nova Launcher) and select "add widget" I see the correct icon in the "Choose Widget" list, but when I select it I get a different icon on the launcher - i.e. the old icon. When I run the app in a Nexus 5 emulator I get the same problem.
Any ideas??
<receiver android:name=".UploadWidget" android:icon="#drawable/upload_widget" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/upload_widget_info" />
</receiver>
UPDATE
Here is upload_widget_info:
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="40dp" android:minHeight="40dp" android:updatePeriodMillis="86400000"
android:previewImage="#drawable/example_appwidget_preview"
android:initialLayout="#layout/upload_widget" android:resizeMode="horizontal|vertical"
android:widgetCategory="home_screen|keyguard"
android:initialKeyguardLayout="#layout/upload_widget"></appwidget-provider>
Your code is correct. This is a common problem on devices running Lollipop. To fix it, navigate through these steps : Settings -> Apps -> Google App -> Manage Space -> Clear Launcher Data. Your shortcuts on the homepage will disappear but the widget icon will be correct.
Source: https://code.google.com/p/android/issues/detail?id=81076&thanks=81076&ts=1417102714
So i developed a widget for android. It all worked fine when i had
default samsung ROM for my sgs3 (android 4.1),
But when i updated my android version to 4.2.2(CM10) i don't see my widget under
'Widgets' category in the android menu.
here is my manifest:
<receiver android:name="ToDoListWidget"
android:label="ToDoList"
android:icon="#drawable/icon" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/items_widget" />
</receiver>
and here is my appwidget-provider:
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="#layout/widget"
android:minHeight="100dp"
android:minWidth="320dp"
android:resizeMode="vertical"
android:updatePeriodMillis="100000" >
</appwidget-provider>
Any ideas what should i cahnge?
EDIT:
Hey, please help me with this one, it happend again right now when i
create a widget in another app.
Is the problem in my code? in my device? in my SDK?
I do believe CyanogenMod does this clever thing of moving your app to the SD card automatically if possible
And any app that is on the SD card cannot add a widget to the home screen (as when the SD card is mounted to a PC the widget would disappear and this would be "strange").
So check your app isn't on the SD card. You might want internalOnly or preferInternal in your AndroidManifest.xml
i just followed the tutorial on tabs creation from the android dev documentation
and my tabs didn't turn out the way they probably should. Here is a screen on how it looks for me:
alt text http://bombhot.se/files/923947/messedtabs.png
and here is how it should look like:
(source: android.com)
I found som threads that talks about putting localisation on the tabhost and make every activity follow the same configuration but it hasn't worked for me so far. Wondering if
there's something i'm missing, here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.koollateral.myWallet"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon"
android:label="#string/app_name">
<activity android:name=".mywallet"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".homeActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".calendarActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
</application>
</manifest>
I've done this API example before, and I think all that has happened is you have swapped your images compared to the example. Note how the tab uses the negative space of the image as the contrasting colour, while you matched the negative space to the background colour. So if you go into your drawable folder and change the xml file you created for the tabs by swapping the images, it should look a little closer to the example.
Other than that, what do you think isn't right? It appears that you have done the exercise correctly.
Edit: also as a tip, you can put android:theme="#android:style/Theme.NoTitleBar"in the <application> instead of having to put it into every Activity. Then none of your activities will have the title bar.
There seem to be two problems. You have listed the images reversed. Meaning you have the selected and unselected images backwards. Also it looks like they are not the right size. You need to consider the dpi of the device you are targeting.
Hi guys since Android 2.1 the tabs are more square look, my solution was adding a selector containing images with rounded corners.
tabs.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.mytab_roundedcorner);