Code Monkey home page Code Monkey logo

Comments (6)

jinlinupup avatar jinlinupup commented on May 29, 2024

参照demo的使用方式,也还是会报该异常

from toastx.

yinshuai0324 avatar yinshuai0324 commented on May 29, 2024

有复现的代码吗?我用Java测试没有复现这个问题

from toastx.

jinlinupup avatar jinlinupup commented on May 29, 2024

感谢您的回复。
View toastRoot = LayoutInflater.from(MainActivity.this).inflate(R.layout.custom_ruler_layout, null);
TextView tvToastText = (TextView) toastRoot.findViewById(R.id.toast_text);
TextView textJump = (TextView) toastRoot.findViewById(R.id.textJump);
textJump.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {}
}
ToastX.with(MainActivity.this)
.customizeView(toastRoot)
.animationMode(ToastX.ANIM_MODEL_SLIDE) //动画模式 弹出或者渐变
.position(ToastX.POSITION_BOTTOM) //显示的位置 顶部或者底部
.duration(3000) //显示的时间 单位ms
.show();


调用代码如上所示。我新开的项目使用没有啥问题,在一个老项目上调用就会报上面的类型转换错误。

from toastx.

yinshuai0324 avatar yinshuai0324 commented on May 29, 2024

可以尝试在您的老项目上用下Design库的Snackbar。看是否表现正常。本库就是基于Snackbar改的。如果直接使用Snackbar表现正常的话 看能否提供可以复现的demo

from toastx.

wo376913879 avatar wo376913879 commented on May 29, 2024

在华为平板 MRR-W29上 会出现这个错误

from toastx.

chende008 avatar chende008 commented on May 29, 2024

我也碰到这样的情况,根据调试走到了这里:
final SnackbarContentLayout content =SnackbarContentLayout)
inflater.inflate( hasSnackbarContentStyleAttrs(context) ? R.layout.mtrl_layout_snackbar_include : R.layout.design_layout_snackbar_include, parent, false);
final Snackbar snackbar = new Snackbar(context, parent, content, content);

hasSnackbarContentStyleAttrs(context) 的值为false,所以取R.layout.design_layout_snackbar_include这个布局,然后就使用系统的snackar,然后就报了类型转换异常

@yinshuai0324 没太懂这里的逻辑,麻烦大佬有时间看看?

from toastx.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.