Android 不兼容的类型指示器。指示器视图
我正在尝试将net.alexandroid.utils.indicators.indicatorView实现到我的项目中 在下面的代码中Android 不兼容的类型指示器。指示器视图,android,android-view,Android,Android View,我正在尝试将net.alexandroid.utils.indicators.indicatorView实现到我的项目中 在下面的代码中 mIndicatorsView = findViewById(R.id.indicatorsView); 我得到: Incompatible types. Required: indicators.IndicatorsView Found: android.view.View 错误,但相关控制器是指示灯。指示灯视图 你知道我为什么会犯这个错误吗 我的X
mIndicatorsView = findViewById(R.id.indicatorsView);
我得到:
Incompatible types.
Required: indicators.IndicatorsView
Found: android.view.View
错误,但相关控制器是指示灯。指示灯视图
你知道我为什么会犯这个错误吗
我的XML是:
<net.alexandroid.utils.indicators.IndicatorsView
android:id="@+id/indicatorsView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:indicatorSize="20dp"
app:paddingBetweenIndicators="16dp"
app:numberOfIndicators="10"
app:selectedIndicator="5"/>
您忘了在这里键入对象。所以在代码中添加这个
mIndicator=(IndicatorsView)findViewById(R.id.indicatorsView);
键入您的IndicateView对象
IndicatorsView inicator=(IndicatorsView) findViewById(R.id.yourid);
类型转换和导入各自的类
替换
mIndicator = findViewById(R.id.indicatorsView);
与
并确保导入了正确的类,即在java文件头中有与下面类似的代码
import net.alexandroid.utils.indicators.IndicatorsView;
你能不能看一下这个示例并遵循ide应该遵循的相同原则help@Raghunandan谢谢……非常欢迎:)@MareCieco
import net.alexandroid.utils.indicators.IndicatorsView;