【问题标题】:Illegal character U+200B android [duplicate]非法字符U + 200B android [重复]
【发布时间】:2018-12-12 16:37:27
【问题描述】:

我会关注以下链接,但对我没有帮助:

每当我添加以下代码时:

// 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

【问题讨论】:

  • 你能分享你的整个 logcat 错误/布局和活动代码
  • in Logcat 无法显示任何错误
  • 我会关注下面的链接,但对我没有帮助 - 我复制了你的代码,得到了同样的错误,删除了空白行,然后它就起作用了。我无法想象它对你不起作用。告诉我为什么我不应该以重复的形式结束这个问题,为什么它对你不起作用?
  • 我已经试过了,这真的不适合我@TimCastelijns
  • 你做了什么?你是剪断线然后把它贴回去还是什么的?如果您只是删除该行,则错误仍然存​​在是不可能的

标签: java android illegal-characters


【解决方案1】:

第三行有一个看不见的字符。手动删除该行并使用键盘重新添加。

尝试用这个替换你的代码:

// 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);
        }
    });

【讨论】:

  • 他声称他已经尝试过了
  • 怎么样?因为他去掉了坏人品!!
  • 我完全删除了第三行,然后使用键盘上的输入按钮将其添加回来
  • 让我们把这个讨论移到我刚刚创建的聊天室chat.stackoverflow.com/rooms/174336/u200b-discussion
猜你喜欢
  • 2013-12-19
  • 2016-11-12
  • 2011-12-08
  • 2013-12-08
  • 1970-01-01
  • 2019-01-02
  • 2012-01-27
  • 2012-06-09
  • 1970-01-01
相关资源
最近更新 更多