点击时旋转器崩溃

时间:2017-09-02 11:44:36

标签: java android spinner

我正在使用Android-Studio

经过几天的编码后,我正在创建一个工作正常的应用

我的旋转器彻底坏了! ....我不会因为其他代码而认为它?

当我点击它应用程序崩溃...

这是我的Spinner代码:

          Spinner s1;
          String[] s1c = {"All","Filter1", "Filter2", "Filter3", "Filter4", "Filter5", "Filter6"};


           s1 = (Spinner) findViewById(R.id.cater);
            ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
                    android.R.layout.simple_spinner_item, s1c);
            s1.setAdapter(adapter);
            s1.setSelection(0);s1.setEnabled(true);


    s1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
        {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
//                filter1=s1c[position];
//                if(mayload ==1) {
//                    loadlist();
//                }else{
//                    mayload=1;
//                }

/*Even Commented anything....*/
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

Spinner XML: .....重要吗?...

   <Spinner
        android:id="@+id/cater"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/textView2" />

LogCat:

09-02 16:12:22.603 28394-28394/com.example.discopc.yubismart W/ResourceType: Too many attribute references, stopped at: 0x01010099
    09-02 16:12:22.603 28394-28394/com.example.discopc.yubismart W/ResourceType: Too many attribute references, stopped at: 0x0101009a
    09-02 16:12:22.603 28394-28394/com.example.discopc.yubismart W/ResourceType: Too many attribute references, stopped at: 0x0101009b
    09-02 16:12:22.625 28394-28394/com.example.discopc.yubismart I/Process: Sending signal. PID: 28394 SIG: 9

它甚至说*Example* Stoped working它会立即退出......

Full Xml

Full Code

我尝试过的事情

清洁项目......

3 个答案:

答案 0 :(得分:2)

检查样式清理项目,然后构建

答案 1 :(得分:0)

此代码适用于我的设备。如果您使用的是 Android Studio : 转到“构建”菜单并选择“清洁项目”,然后尝试运行它。

答案 2 :(得分:0)

我有android:theme="@android:style/TextAppearance.Material" 样式中的一些

我删除了它并且工作正常......

感谢 vikas kumar