Top Related Projects
:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion
Give a custom shape to any android view, Material Design 2 ready
Implementation of ExpandableListview with custom header and custom content.
You can easily add awesome animated context menu to your app.
Android Floating Action Button based on Material Design specification
Quick Overview
AndroidSweetSheet is an Android library that provides a customizable bottom sheet UI component. It offers a sleek and animated way to display additional options or information from the bottom of the screen, similar to the bottom sheets found in many popular apps.
Pros
- Smooth and customizable animations for showing and hiding the sheet
- Multiple built-in styles (fatup, sweet, and custom)
- Easy integration with existing Android projects
- Supports both vertical and horizontal layouts
Cons
- Limited documentation and examples
- Not actively maintained (last update was several years ago)
- May not be fully compatible with the latest Android versions or Material Design guidelines
- Lacks some advanced features found in more recent bottom sheet implementations
Code Examples
- Basic implementation of a SweetSheet:
SweetSheet sweetSheet = new SweetSheet(parentView);
sweetSheet.setMenuList(R.menu.menu_sweet);
sweetSheet.setDelegate(new ViewPagerDelegate());
sweetSheet.show();
- Using a custom style:
CustomDelegate customDelegate = new CustomDelegate(true,
CustomDelegate.AnimationType.DuangLayoutAnimation);
customDelegate.setCustomView(R.layout.layout_custom_sweet);
sweetSheet.setDelegate(customDelegate);
- Handling item selection:
sweetSheet.setOnMenuItemClickListener(new SweetSheet.OnMenuItemClickListener() {
@Override
public boolean onItemClick(int position, MenuEntity menuEntity) {
// Handle item click
return false;
}
});
Getting Started
To use AndroidSweetSheet in your project:
- Add the JitPack repository to your root build.gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency to your app's build.gradle:
dependencies {
implementation 'com.github.zzz40500:AndroidSweetSheet:1.1.0'
}
- In your activity or fragment, create and show a SweetSheet:
SweetSheet sweetSheet = new SweetSheet(findViewById(R.id.parentView));
sweetSheet.setMenuList(R.menu.your_menu);
sweetSheet.setDelegate(new RecyclerViewDelegate(true));
sweetSheet.show();
Competitor Comparisons
:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion
Pros of folding-cell-android
- More sophisticated animation with a folding effect
- Better suited for displaying detailed content expansions
- Actively maintained with recent updates
Cons of folding-cell-android
- More complex implementation compared to AndroidSweetSheet
- Limited to a specific folding cell design, less versatile
Code Comparison
AndroidSweetSheet:
mSweetSheet = new SweetSheet(rl_main);
mSweetSheet.setMenuList(R.menu.menu_sweet);
mSweetSheet.setDelegate(new ViewPagerDelegate());
mSweetSheet.toggle();
folding-cell-android:
val foldingCell = findViewById<FoldingCell>(R.id.folding_cell)
foldingCell.setOnClickListener {
foldingCell.toggle(false)
}
AndroidSweetSheet offers a simpler implementation for basic bottom sheets, while folding-cell-android provides a more intricate folding animation but requires more setup. AndroidSweetSheet is more flexible for various sheet styles, whereas folding-cell-android focuses on a specific folding cell design. Both libraries serve different purposes and can be chosen based on the specific UI requirements of the project.
Give a custom shape to any android view, Material Design 2 ready
Pros of ShapeOfView
- More versatile, allowing for various shape transformations beyond just bottom sheets
- Supports custom shapes through path definitions
- Easier integration with existing views and layouts
Cons of ShapeOfView
- Lacks specific bottom sheet functionality
- May require more custom code for complex interactions
- Not specifically optimized for bottom sheet use cases
Code Comparison
ShapeOfView:
<com.github.florent37.shapeofview.shapes.CircleView
android:layout_width="150dp"
android:layout_height="150dp"
app:shape_circle_borderColor="@android:color/black"
app:shape_circle_borderWidth="2dp">
<!-- Your content here -->
</com.github.florent37.shapeofview.shapes.CircleView>
AndroidSweetSheet:
mSweetSheet = new SweetSheet(fl);
mSweetSheet.setMenuList(R.menu.list);
mSweetSheet.setDelegate(new ViewPagerDelegate());
mSweetSheet.toggle();
While AndroidSweetSheet provides a more specialized solution for bottom sheets with pre-built menu functionality, ShapeOfView offers greater flexibility for creating custom-shaped views throughout an application. ShapeOfView requires more manual setup for specific use cases like bottom sheets but allows for more diverse shape transformations. AndroidSweetSheet is more focused on providing a quick and easy bottom sheet implementation with built-in menu support.
Implementation of ExpandableListview with custom header and custom content.
Pros of ExpandableLayout
- Focused on a specific UI component (expandable layouts)
- Simpler implementation for basic expandable views
- Lightweight and easy to integrate into existing projects
Cons of ExpandableLayout
- Limited to expandable layouts, less versatile than AndroidSweetSheet
- Fewer customization options for animations and styling
- Less active development and community support
Code Comparison
ExpandableLayout:
ExpandableLayout expandableLayout = findViewById(R.id.expandable_layout);
expandableLayout.setExpandInterpolator(new BounceInterpolator());
expandableLayout.setCollapseInterpolator(new DecelerateInterpolator());
expandableLayout.toggle();
AndroidSweetSheet:
mSweetSheet = new SweetSheet(rl_main);
mSweetSheet.setMenuList(R.menu.list);
mSweetSheet.setDelegate(new ViewPagerDelegate());
mSweetSheet.toggle();
Both libraries offer simple methods to toggle their respective UI components. ExpandableLayout focuses on expanding and collapsing a single view, while AndroidSweetSheet provides a more complex bottom sheet implementation with various delegate options and menu integration.
You can easily add awesome animated context menu to your app.
Pros of Context-Menu.Android
- More customizable appearance with various animation options
- Supports both vertical and horizontal menu layouts
- Better documentation and examples provided in the repository
Cons of Context-Menu.Android
- Limited to context menu functionality, less versatile than AndroidSweetSheet
- Slightly more complex implementation compared to AndroidSweetSheet
- May require more setup code for basic usage
Code Comparison
Context-Menu.Android:
MenuParams menuParams = new MenuParams();
menuParams.setActionBarSize((int) getResources().getDimension(R.dimen.tool_bar_height));
menuParams.setMenuObjects(getMenuObjects());
menuParams.setClosableOutside(false);
mMenuDialogFragment = ContextMenuDialogFragment.newInstance(menuParams);
AndroidSweetSheet:
mSweetSheet = new SweetSheet(fl);
mSweetSheet.setMenuList(R.menu.list);
mSweetSheet.setDelegate(new RecyclerViewDelegate(true));
mSweetSheet.setBackgroundEffect(new DimEffect(0.5f));
mSweetSheet.show();
Both libraries offer unique approaches to creating interactive menus in Android applications. Context-Menu.Android focuses on providing a highly customizable context menu with various animation options, while AndroidSweetSheet offers a more versatile bottom sheet implementation. The choice between the two depends on the specific requirements of your project and the desired user experience.
Android Floating Action Button based on Material Design specification
Pros of FloatingActionButton
- Focused specifically on implementing Material Design floating action buttons
- Provides more customization options for FAB appearance and behavior
- Easier to integrate for projects primarily needing FAB functionality
Cons of FloatingActionButton
- Limited to FAB implementation, less versatile for other UI components
- May require additional libraries for more complex UI interactions
- Less suitable for projects needing comprehensive bottom sheet solutions
Code Comparison
FloatingActionButton:
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fab_colorNormal="@color/colorPrimary"
app:fab_size="normal" />
AndroidSweetSheet:
mSweetSheet = new SweetSheet(rootView);
mSweetSheet.setMenuList(R.menu.menu_sweet);
mSweetSheet.setDelegate(new ViewPagerDelegate());
mSweetSheet.toggle();
While FloatingActionButton focuses on implementing Material Design FABs with extensive customization options, AndroidSweetSheet offers a more comprehensive solution for creating interactive bottom sheets with various layouts and animations. FloatingActionButton is ideal for projects specifically needing FAB functionality, while AndroidSweetSheet provides a versatile toolkit for creating rich bottom sheet experiences.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
ä¸ä¸ªå¯æå¨æç Sheet, å åä¸¤å¼ å¾:
###gradle
/build.gradle
repositories {
maven {
url "https://jitpack.io"
}
}
/app/build.gradle
compile 'com.github.zzz40500:AndroidSweetSheet:1.1.0'
###Usage:
// SweetSheet æ§ä»¶,æ ¹æ® rl 确认ä½ç½®
mSweetSheet = new SweetSheet(rl);
//设置æ°æ®æº (æ°æ®æºæ¯æ设置 list æ°ç»,ä¹æ¯æä»menu èµæºä¸è·å)
mSweetSheet.setMenuList(list);
//æ ¹æ®è®¾ç½®ä¸åç Delegate æ¥æ¾ç¤ºä¸åçé£æ ¼.
mSweetSheet.setDelegate(new RecyclerViewDelegate(true));
//æ ¹æ®è®¾ç½®ä¸åEffectæ¥è®¾ç½®èæ¯ææ:BlurEffect 模ç³ææ.DimEffect åæææ,NoneEffect 没æææ.
mSweetSheet.setBackgroundEffect(new BlurEffect(8));
//设置èåç¹å»äºä»¶
mSweetSheet.setOnMenuItemClickListener(new SweetSheet.OnMenuItemClickListener() {
  @Override
  public boolean onItemClick(int position, MenuEntity menuEntity1) {
    //æ ¹æ®è¿åå¼, true ä¼å
³é SweetSheet ,false åä¸ä¼.
    Toast.makeText(MainActivity.this, menuEntity1.title + " " + position, Toast.LENGTH_SHORT).show();
    return true;
  }
});
èªå®ä¹æ©å±:
// SweetSheet æ§ä»¶,æ ¹æ® rl 确认ä½ç½®
mSweetSheet3 = new SweetSheet(rl);
//å®ä¹ä¸ä¸ª CustomDelegate ç Delegate ,并ä¸è®¾ç½®å®çåºç°å¨ç».
CustomDelegate customDelegate = new CustomDelegate(true,
    CustomDelegate.AnimationType.DuangLayoutAnimation);
View view = LayoutInflater.from(this).inflate(R.layout.layout_custom_view, null, false);
//设置èªå®ä¹è§å¾.
customDelegate.setCustomView(view);
//设置代çç±»
mSweetSheet3.setDelegate(customDelegate);
//å 为使ç¨äº CustomDelegate æ以mSweetSheet3ä¸ç setMenuListåsetOnMenuItemClickListener就没æææäº
view.findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
    mSweetSheet3.dismiss();
  }
});
çå¬è¿å
@Override
public void onBackPressed() {
if(mSweetSheet.isShow()){
mSweetSheet.dismiss();
}
else{
super.onBackPressed();
}
}
###v1.1(çæ¬è¯´æ)
- å»æä¹åViewPager 使ç¨FragmentStatePagerAdapter å为å®çéé å¨.
-
SweetSheet ä¸æ¯æ LinearLayout ä½ä¸ºå®çç¶æ§ä»¶.
-
setMenuList 设置æ°æ®æºæ¯æä» List
æ°ç»åMenuèµæºçå¡«å .(Menuä» æ¯æä¸çº§Menu,å 为2级Menuæè¿æ²¡æ³å¥½æä¹å±ç¤º). -
setBackgroundEffect(Effect effect) æä¾å¯¹èæ¯ææçæ¯æ,ç®åæä¾3ç§é£æ ¼: BlurEffect:模ç³ææ,DimEffect åæææ,NoneEffect 没æææ. ä½ ä¹å¯ä»¥ç»§æ¿Effectæ©å±èæ¯çææ
-
setDelegate ç®åæä¾äºä¸ç§é£æ ¼ RecyclerViewDelegate,ViewPagerDelegate,CustomDelegate.
-
CustomDelegateç¨äºæ©å±ç±»,ä½ å¯ä»¥ä½¿ç¨éè¿æé æ¹æ³æå®åºç°å¨ç»,éè¿setCustomView(View v)æ¥è®¾ç½®ä½ çèªå®ä¹çå¸å±.
-
CustomDelegateä¸æä¾äº4ç§ç±»å: DuangLayoutAnimation,DuangAnimation, AlphaAnimation,Custom: çåå大æ¦å°±è½ç¥éå®æ¯ä»ä¹ææ.å¦æä½ å¯¹å3个ææä¸æ»¡æä½ å°±ä½¿ç¨ Custom ,ç¶åéè¿setCustomViewAnimation设置åºç°ææ.
-
CRImageView å é¨å®ç°äº Android 5.0ä¸é¢çCircleRevealææ.使ç¨æ¹æ³:
CRImageView. circularReveal(int centerX, int centerY, float startRadius, float endRadius, long duration, Interpolator interpolator)
ä½ å¯ä»¥å¨ä½ ç项ç®ä¸ç¨ä¸å®.
###FAQ æä¹ä½¿å æ¬ actionBar å¨å çèæ¯ä¹èå? ä½¿ç¨ ä¸ä¸ª FrameLayoutæè RelativeLayout éé¢ä½¿ç¨ ToolBar æ¥æ¿ä»£ ActionBar å°è¿ä¸ª FrameLayout æè RelativeLayoutä½ä¸ºSweetSheet çç¶æ§ä»¶ä¼ éè¿å»,
Top Related Projects
:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion
Give a custom shape to any android view, Material Design 2 ready
Implementation of ExpandableListview with custom header and custom content.
You can easily add awesome animated context menu to your app.
Android Floating Action Button based on Material Design specification
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot