在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):javiersantos/BottomDialogs开源软件地址(OpenSource Url):https://github.com/javiersantos/BottomDialogs开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):BottomDialogsAndroid LibraryAndroid Library that shows a customizable Material-based bottom sheet. How to includeAdd the repository to your project build.gradle: repositories {
maven {
url "https://jitpack.io"
}
} And add the library to your module build.gradle: dependencies {
compile 'com.github.javiersantos:BottomDialogs:1.2.1'
} UsageBasic Bottom DialogA basic bottom dialog will be shown. You have access to methods such as new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.show(); or BottomDialog bottomDialog = new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.build();
...
bottomDialog.show(); Displaying an iconThe bottom dialog icon will be shown to the left of the title. new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.setIcon(R.drawable.ic_launcher)
//.setIcon(ContextCompat.getDrawable(this, R.drawable.ic_launcher))
.show(); Adding buttons and callbacksButtons are showed at the end of the bottom dialog. You can add your own text, colors and actions/callbacks. new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.setPositiveText("OK")
.setPositiveBackgroundColorResource(R.color.colorPrimary)
//.setPositiveBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimary)
.setPositiveTextColorResource(android.R.color.white)
//.setPositiveTextColor(ContextCompat.getColor(this, android.R.color.colorPrimary)
.onPositive(new BottomDialog.ButtonCallback() {
@Override
public void onClick(BottomDialog dialog) {
Log.d("BottomDialogs", "Do something!");
}
}).show(); new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.setNegativeText("Exit")
.setNegativeTextColorResource(R.color.colorAccent)
//.setNegativeTextColor(ContextCompat.getColor(this, R.color.colorAccent)
.onNegative(new BottomDialog.ButtonCallback() {
@Override
public void onClick(BottomDialog dialog) {
Log.d("BottomDialogs", "Do something!");
}
}).show(); If no If Dismissing when touching outsideThe new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.setCancelable(false)
.show(); Adding a custom viewYou can add custom view to your bottom dialog just by adding the layout to the new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.setCustomView(R.layout.my_custom_view)
.show(); A detailed description is available at: https://github.com/javiersantos/BottomDialogs/wiki/Adding-a-custom-view Adding a custom color and fontYou can add custom colors and fonts to bottom dialog by using the view objects: BottomDialog bottomDialog = BottomDialog.Builder(this)
...
.build();
bottomDialog.getTitleTextView().setTextColor(Color.parseColor("#8f000000"));
bottomDialog.getTitleTextView().setTypeface(BaseActivity.getFont(Fonts.SEMI_BOLD));
bottomDialog.show(); Third Party BindingsReact NativeYou may now use this library with React Native via the module here License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论