How can I clone this behaviour (iOS) on an Android-App?
Technically its definitly possible as I have an app by my own on my Androidphone - its an Email-App with a very similiar indicator on the Icon. (shows the number of unread Emails)
yes you can implement overlay like ios.. by the way it is called badge value.
here is one sample available on github
You just have to add classes in your project and call below lines
View target = findViewById(R.id.target_view);
BadgeView badge = new BadgeView(this, target);
badge.setText("1");
badge.show();
hope it helps.
If you are referring to doing this on the home screen, that is an app widget.
Related
I have just started developing an android weather app and I was wondering how to change activity background automatically. For example, in daytime it should show day time or in the night it should show night photos.
This is the app of Sony which has a feature (mentioned above)
Check the screenshots.
Okay Credit goes to SteD;so for you check this(beginner's guide)
Follow this
//set an ID for Relative Layout in content_main.xml(Android Studio)
RelativeLayout rlayout=(RelativeLayout)findViewById(R.id.rlayout);
if(something){Drawable drawble=getResource().getDrawable(R.drawable.your_image);rlayout.setBackgroundDrawable(drawable);}
//If it works,destroy the upvote
The only automatic way is the newly released (Day/Night theme for android app)
For finer control you check the condition yourself and call the normal Java methods, like this:
if(something) {
getWindow()
.setBackgroundDrawable(ContextCompat.getDrawable(this, R.drawable.image));
}
of if you don't care about the newly introduced context themed styling, you just call the deprecated method (which will keep working without issues for all the foreseeable future)
if(something) {
getWindow()
.setBackgroundDrawable(
getResources().getDrawable(R.drawable.image));
}
navigation in Android TV.
How do I create just the navigation android tv. I do not care to use the entire theme, it provides android studio.
And I do not understand much of what is in the example given by android studio.
I understand that is something the String.
I looked on the internet examples, but right now, android tv has no further information at this time.
I'm interested only create menu navigation side, nothing more.
Thank you very much.
I found a really nice tutorial : http://corochann.com/browsefragment-header-customization-android-tv-application-hands-on-tutorial-17-697.html
it shows you how to create a custom navigation side with an image and a text
Here what a tried in my application :
copy his IconHeaderItem class and in your loadRows paste
IconHeaderItem gridItemPresenterHeader = new IconHeaderItem(0, BEWELL_THERMO, R.drawable.bewell_thermo);
GridItemPresenter mGridPresenter = new GridItemPresenter();
ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter);
gridRowAdapter.add(DERNIERE_MESURE);
gridRowAdapter.add(GRID_STRING_GUIDED_STEP_FRAGMENT);
gridRowAdapter.add(GRID_STRING_RECOMMENDATION);
gridRowAdapter.add(GRID_STRING_SPINNER);
mGridItemListRow = new ListRow(gridItemPresenterHeader, gridRowAdapter);
mRowsAdapter.add(mGridItemListRow);
setAdapter(mRowsAdapter);
As we all know,google release the android L,and the gmail went into more beautiful.Now I want to use this pattern like the pic,I searched it everywhere,github included, only to find that nothing.
THX deeply in advanced! Here is the pic:
oh!I'm sorry,I forget to mention that the new refresh layout,could you see the circle within a Curved arrow.swipe the screen down,and it begin to refresh,maybe it's s new swipefreshlayout,thx!
This is the new SwipeRefreshLayout class that is included in the latest support library. The implementation is exactly the same as the old support swipeRefresh layout
Here an overview:
http://www.google.com/design/spec/material-design/introduction.html
Here is explained how to use it: https://developer.android.com/training/material/index.html
I need to do animation like it is there in Recent App section in Android 5.0.
Like shown in the image below. Any hint or link or even the Animation type used here would be helpful.
Take a look here: https://github.com/vikramkakkar/DeckView
There is also an example here. You can also find about RecentsView here:
https://github.com/android/platform_frameworks_base/blob/59701b9ba5c453e327bc0e6873a9f6ff87a10391/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
I have never done this, but I can point you in the right direction to use StackView. It was added in API level 11 (Android 3.0)
I have found some examples
http://www.broculos.net/2011/12/android-101-how-to-create-stackview.html
http://www.informit.com/articles/article.aspx?p=2078060&seqNum=3
http://www.thaicreate.com/mobile/android-stackview.html
Also this library looks decent
https://github.com/blipinsk/FlippableStackView
Take a look here: https://github.com/ZieIony/MaterialRecents I personally tried it and it looks promising.
You can always look at the official Android source code.
Check the method startRecentsActivity() under packages/SystemUI from the official Android source code.
It's not a very easy-to-read code, but it's definitely the best and most reliable source if you really want to mimic the official Android Lollipop animations.
i have created a github repo with my class i hope it helps,
it's is the start i hope it helps
Stack Cards Android
it makes the same as your image
you can set the difference between cards, scale from card to card,
animation duration, number of cards of course
usage easy just include the class &
// **Paramters definitions** :
// Activity owningActivity, RelativeLayout container, int cardHeightDP, int cardDiffDP,float cardScale, int animationDuration)
StackCards stackCards = new StackCards(yourActivity.this, cardsContainer, 100, 50, (float) 0.2, 500);
//(Number of Cards, The Layout of the Card)
stackCards.initCards(7, R.layout.stack_card);
I have written a program that can create shortcut of my application in android emulator homescreen.But the problem is when i created the shortcut then it has the default android icon.
My question is how can i change the icon of the shortcut ?
I have used the following line to set the icon
Intent j=new Intent();
j.putExtra(Intent.EXTRA_SHORTCUT_INTENT,i);
j.putExtra(Intent.EXTRA_SHORTCUT_NAME,n);
j.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,R.drawable.icon);
j.putExtra ("duplicate", false);
j.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
sendBroadcast(j);
The system is not in your context. You therefore need to give more details to send you icon.
see https://github.com/ldo/ShortcutCircus_Android/blob/master/src/Activity2.java
The icon is given by :
Intent.ShortcutIconResource.fromContext(Activity2.this, R.drawable.icon)
Or you could decode the bitmap and use EXTRA_SHORTCUT_ICON instead.
You can do this in two way.
putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,resId);
putExtra(Intent.EXTRA_SHORTCUT_ICON, bitmap);