如何在烤面包消息中隐藏包装名称?

时间:2019-07-25 12:40:16

标签: java android android-studio

如何在敬酒消息前删除软件包名称(Javascript)?

包裹名称:

const sum = function(x,y,z){
	return	Number(x) + Number(y)+Number(z);
};

console.log(sum('',5,7));

activity_main.xml

com.company.javascript

MainActivity.java

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/btn_hello"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

enter image description here

1 个答案:

答案 0 :(得分:0)

感谢@CommonsWare,此问题是由某些设备制造商修改了Toast的行为引起的,因此,如果有必要这样做,我们必须覆盖Toast.makeText然后显示它

public class ToastUtils {

    public static void showToast(Context context, String message, int duration) {
        Toast toast = Toast.makeText(context, message, duration);
        ViewGroup group = (ViewGroup) toast.getView();
        TextView tvMessage = (TextView) group.getChildAt(0);
        tvMessage.setText(message);
        tvMessage.setGravity(Gravity.CENTER);
        toast.show();
    }
}