HoloEverywhere SeekBar ClassCastException

∥☆過路亽.° 提交于 2019-12-11 00:02:44

问题


I am using the SeekBar class provided by HoloEverywhere. I have the following imports:

import org.holoeverywhere.widget.SeekBar;
import org.holoeverywhere.widget.SeekBar.OnSeekBarChangeListener;

I get no preliminary errors or warnings, but when I compile, I get a class cast exception on the following line:

sectionTimeElapsedSeekBar = (SeekBar) findViewById(R.id.sectionTimeElapsedSeekBar);

Here is the corresponding XML:

<SeekBar
        android:id="@+id/sectionTimeElapsedSeekBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/startOrPauseTimerButton"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="16dp"
        android:max="2100" />

Anyone have any ideas?


回答1:


Change to:

<org.holoeverywhere.widget.SeekBar
        android:id="@+id/sectionTimeElapsedSeekBar"
        ...
        />



回答2:


Extend activity from org.holoeverywhere.app.Activity.




回答3:


try importing:

import android.widget.SeekBar;

instead of

import org.holoeverywhere.widget.SeekBar;


来源:https://stackoverflow.com/questions/14369534/holoeverywhere-seekbar-classcastexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!