У меня есть одно действие, в котором есть одно всплывающее окно Dialog
.Во всплывающем окне «Активность» у меня есть ImageButton
, чтобы показать SnackBar
.Проблема в том, что SnackBar
показывает в активности не во всплывающем окне Dialog
.
Я использую FlashBar из этого https://github.com/aritraroy/Flashbar
Можно показать FLashBar
над всплывающим диалоговым окном?
MyPopup.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="350dp"
android:layout_height="550dp"
android:background="@color/white"
android:layout_gravity="center">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/txtInfo"
android:layout_width="25dp"
android:layout_height="25dp"
android:textColor="@color/black"
android:layout_margin="10dp"
android:text="i"
android:textStyle="bold"
android:gravity="center"
android:onClick="showInfoPengumuman"
android:background="@drawable/circlebackground"/>
</RelativeLayout>
</LinearLayout>
myActivity.java
public void showPopupPengumuman(View v){
TextView txtInfo = (TextView) myDialog.findViewById(R.id.txtInfo);
txtInfo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showInfoPengumuman();
}
});
myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
myDialog.show();
};
private Flashbar primaryActionListener() {
return new Flashbar.Builder(this)
.gravity(Flashbar.Gravity.BOTTOM)
.title("Tata Cara Upload Pengumuman")
.showIcon()
.backgroundColorRes(R.color.colorPrimaryDark)
.enterAnimation(FlashAnim.with(this)
.animateBar()
.duration(750)
.alpha()
.overshoot())
.exitAnimation(FlashAnim.with(this)
.animateBar()
.duration(400)
.accelerateDecelerate())
.message("Lengkapi Deskripsi -> Tambah -> Validasi Deskripsi -> Publish")
.primaryActionText("DISMISS")
.primaryActionTapListener(new Flashbar.OnActionTapListener() {
@Override
public void onActionTapped(@NotNull Flashbar bar) {
bar.dismiss();
}
})
.build();
}
private void showInfoPengumuman(){
flashbar = primaryActionListener();
flashbar.show();
}