问题
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