Android widget preview image - android

As I have been seeing out there, most of Android Widget preview images follow a design pattern which contains a simple image Centre-Vertical and left aligned with the same image's big grey shadow below it. See the Android Contacts Widget image:
If the user wants to add the widget to the screen dragging it, the logo will be the only image object which is going to be dragged and not its shadow. Trying to emulate this kind of images for my widget, I have created a simple PNG24 with a logo and its shadow below, but when dragging it both the logo and the shadow are dragged, and not just the logo as the mentioned widgets do.
How do they do to achieve that behaviour?

The design pattern you are talking about it's only applied to bookmark widgets, and its done automatically.
This is, when your activity uses the intent filter ACTION_CREATE_SHORTCUT, the launcher app adds a widget to its widget list and uses the android:icon attribute of that activity to create that design. If you don't provide an android:icon attribute in that activity, it will use the application icon
You can easily see the expected result without really implementing the functionality by adding:
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
</intent-filter>
to one of your activities.

Related

Android T:V Background customisation

I have five background images which are displayed back to back after a certain time interval. I have to add a page indicator for backgrounds so that user can know which background is currently selected. The user should also be able to select next backgrounds using tv remote.
I cannot compromise tv look and feel for rail and its contents which are displayed on the screen.
I also need to resize background image. I do not want the image to be full screen and its size should cover half portion of tv only. Background image should overlap first rails content to an extent.
I am not getting any such sample or blogs depicting customization of background. Any help would be really appreciated..!!!
Try to use layout themes for TV.
Android Themes can provide a basis for layouts in your TV apps.
You should use a theme to modify the display of your app activities
that are meant to run on a TV device. This section explains which
themes you should use.
Style and Themes can be:
A style is a collection of attributes that specify the look and format
for a View or window. A style can specify attributes such as height,
padding, font color, font size, background color, and much more. A
style is defined in an XML resource that is separate from the XML that
specifies the layout.
You can see samples codes as well from the documentation.
I added two fragments inside my Activity. One fragment is for displaying background and indicator. While another fragment is extending BrowseFragment of leanback library, and is used to display rails/headers as is depicted in tv app android sample which is generated via android studio.

Does elevation not work within Android Home Screen Widgets?

Tried all sorts of different ways to do this but not matter what view I apply an elevation to (such as android:elevation="10dp") it does not render correctly on a Home Screen Widget.
Is this a known limitation, that home screen widgets do not support elevation. I am running this on an Android L device so its should not be a compatibility issue.
If this is impossible I figure I could use 9-patch or layer-list drawable to achieve a similar but not as good effect.
I've played with all widgets I have on my phone (both with Nova Launcher and Nexus 5 stock launcher, which is Google) and none of them have this feature, even Google apps (excluding Google Now!).
I've added app:elevation="10dp" on my widget and I think that it is not possible to have this feature on Widget directly, without playing with code and fantasy.
If you really want a widget that include elevation design, just "copy" the style of Google Now widget.
I suppose that they have a transparent layout (the black parts on image) wich contains another layout (grey) with elevation and grid filled with CardView with elevation too.
Let me know if you want an example code.

Using user's current homescreen (w/ icons) in app

I want to use the user's current homescreen as an element of an app, including their icons and layout. I do not expect it to be dynamic, just a static image of their screen upon which the app can act. The "Cracked Screen" app does this like I'm thinking.
In researching, I've found ways to grab a screenshot (requires root) or grab the current wallpaper (doesn't include icons), but nothing yet about this particular issue.
Any ideas? Thanks!
Use the translucent theme. Set it in your AndroidManifest for the relevant activity like this:
<activity android:theme="#android:style/Theme.Translucent"
...>
This sets the users homescreen with it's icons as the background of the activity, your views float over that. Alternatively you can use #android:style/Theme.Translucent.NoTitleBar if you want to hide the title bar additionally.

Yahoo Fantasy App styled buttons

I'm trying to accomplish the style of buttons used in the yahoo fantasy football app. On the nav bar located at the bottom of the screen there are buttons. Now I've extracted the assets from the app so I know that the magnifying glass is of course an image, but there are two. A blue one and a grey one. However the button "underlay" which is transparent doesn't appear to be an image.
Example: http://i.stack.imgur.com/ASNzz.jpg
I want to replicate this type of button, with the following characteristics.
A gradient background (I know how to do this, but I want to be clear that #2 needs to be able to reflect a background that isn't a solid color)
A "button underlay" that is transparent with rounded corners, like the example.
Changing icons (magnifying glass)
And then of course, it being a button. More specifically launching another activity in my app.
I think that Yahoo has copied the iPhone TabBar style for that app, but it's a simple TabHost interface (here's the tutorial)
On the internet you can find many XML examples for the TabBar style, I suggest these ones (that in my opinion are the best)
https://github.com/AdilSoomro/Iphone-Tab-in-Android : the graphical best one IMHO
https://github.com/honcheng/ScrollableTabHost-for-Android : in this one the TabBar is horizonally scollable
http://www.anddev.org/code-snippets-for-android-f33/iphone-tabs-for-android-t14678.html : a very easy one to implement
But I have a thing to ask you: is for your application necessary to copy the iPhone style? I leave here the link to Londatiga's QuickActions which are the same style as the contacts app, twitter app, gallery app, and many many more - and it's a recommended style by the Google's engineers. It's more "androidish" ;)

Title of Android AppWidget below widget-icon

I am working on a small application which should be represented by an AppWidget.
The AppWidget should look like many other widgets on my HTC Desire. Most of them consist of an icon and a title below the icon. The title always looks identical, it is white text on a black rounded banner. I have not found a way to get this layout without painting all by myself. What do I have to do, to get the app title shown below the AppWidget?
Thank in advance,
Wolfgang
Per a previous answer here this is actually discouraged by the Android UI guidelines: An App shortcut has such text below it, and it may change in future Android releases or in custom skins such as HTC Sense or MOTOblur. A widget should be a wholly contained graphical element without a text label below it. You need to find a way to make graphics / text in your widget which are self identifying to the user.

Categories

Resources