非法字符U + 200B android

时间:2018-07-04 09:25:40

标签: java android illegal-characters

我会点击以下链接,但对我没有帮助:

只要我添加以下代码:

// get our folding cell
        final FoldingCell fc = (FoldingCell) findViewById(R.id.folding_cell);
​
        // attach click listener to folding cell
        fc.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                fc.toggle(false);
            }
        });

此错误来了:Illegal character U+200B

错误未显示在Logcatmassage上,错误显示在MainActivity.class下方的findviewById

activity_main.xml

<LinearLayout
    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="com.foldingcell.MainActivity">

    <com.ramotion.foldingcell.FoldingCell
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/folding_cell"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipChildren="false"
        android:clipToPadding="false"
        >
        ​
    </com.ramotion.foldingcell.FoldingCell>

</LinearLayout>

我复制了听到的代码:https://android-arsenal.com/details/1/3426

1 个答案:

答案 0 :(得分:3)

第三行上有一个不可见的字符。手动删除该行,然后使用键盘再次添加。

尝试用此代码替换您的代码:

// get our folding cell
    final FoldingCell fc = (FoldingCell) findViewById(R.id.folding_cell);

    // attach click listener to folding cell
    fc.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            fc.toggle(false);
        }
    });
相关问题