在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):hariprasanths/GoogleNewsStandAnimation-Android开源软件地址(OpenSource Url):https://github.com/hariprasanths/GoogleNewsStandAnimation-Android开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):Google-NewsStand-Animation-AndroidNavigation pattern like in Google News Stand app with transitions Getting StartedIn your build.gradledependencies {
implementation 'hari.allagi:allagi:0.1.1'
//or in lower versions:
//compile 'hari.allagi:allagi:0.1.1'
} UsageChoose one of the NoActionBar themes to use in <style name="AppTheme.MenuListActivity.NoActionBar" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent" >@color/colorAccent</item>
</style> Define the colors for <style name="AppTheme.ScrollableMenuActivity.NoActionBar" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style> Declare the Allagi activities in <activity
android:name="hari.allagi.MenuListActivity"
android:theme="@style/AppTheme.MenuListActivity.NoActionBar" />
<activity
android:name="hari.allagi.ScrollableMenuActivity"
android:theme="@style/AppTheme.ScrollableMenuActivity.NoActionBar" /> Set largeHeap to true in <application
...
android:largeHeap="true"/> Open Allagi from a activity like so: ArrayList<String> menuList = new ArrayList<>(); //menu titles
ArrayList<Integer> imagesList = new ArrayList<>(); //menu backgrounds
ArrayList<Fragment> fragmentsList = new ArrayList<>(); //fragments for each menu headers in second activity
menuList.add("UPCOMING"); //add titles
menuList.add("EVENTS"); //limit to 8 items for the animation to work
...
imagesList.add(R.drawable.upcoming); //add background images
imagesList.add(R.drawable.events);
...
fragmentsList.add(UpcomingFragment.newInstance()); //add fragment instances
fragmentsList.add(EventsFragment.newInstance());
...
Allagi allagi = Allagi.initialize(MainActivity.this, menuList, imagesList, fragmentsList);
allagi.start(); //start the menu list activity Change the duration of the animation: allagi.setTransitionDuration(900); //default value is 1000 milliseconds Libraries used in the project
CreditsInspired by and thanks to Aurélien Salomon's Google Newsstand Navigation Pattern Show your supportGive a LicenseCopyright This project is licensed under the Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论