好,我有1个自定义吐司(XML布局)和它巨大的:

    LayoutInflater inflater = getLayoutInflater();
    View layout = inflater.inflate(R.layout.custom_toast, (ViewGroup) findViewById(R.id.toast_layout));
    ImageView image = (ImageView) layout.findViewById(R.id.logo);        
    image.setImageResource(R.drawable.logo);
    title = (TextView) layout.findViewById(R.id.title);        
    txt = (TextView) layout.findViewById(R.id.text);
    toast = new Toast(appContext);
    toast.setGravity(Gravity.FILL_HORIZONTAL|Gravity.BOTTOM, 0, 0);
    toast.setDuration(Toast.LENGTH_LONG);
    toast.setView(layout);        

但是,当我试图让一个2号同样的方式,我得到错误“未找到源”,它并没有真正告诉我什么是错的东西。

    LayoutInflater infl = getLayoutInflater();
    View lay = infl.inflate(R.layout.toast_arrows, (ViewGroup) findViewById(R.id.toast_lay));                        
    toastarrows = new Toast(appContext);
    toastarrows.setGravity(Gravity.FILL_HORIZONTAL|Gravity.CENTER, 0, 0);
    toastarrows.setDuration(Toast.LENGTH_SHORT);
    toastarrows.setView(lay);                
    toastarrows.show();

我想那些2个干杯出现在屏幕的不同的地方几乎相同的时间。 任何人都可以请告诉我什么是错与此代码?

有帮助吗?

解决方案

你确信你可以在同一时间显示2吐司? 我不知道这一点,我尝试过,但我只能显示一条吐司。 你试图表明只有第二个?

其他提示

看来,如果你真的在的Sametime创建两个敬酒,他们仍然会显示一个又一个在同一个地方。所以我觉得有点吃力你的虚荣。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top