无法将类型为“ android.view.ViewGroup”的实例分配给类型为“ com.android.keyguard.ChallengeLayout”的变量

时间:2018-09-19 12:51:59

标签: java android

如何解决此错误

  

类型'android.view.ViewGroup'的实例不能分配给   类型com.android.keyguard.ChallengeLayout

的变量

代码

ChallengeLayout challenge = mSlidingChallengeLayout != null ? 
mSlidingChallengeLayout : mMultiPaneChallengeLayout;

1 个答案:

答案 0 :(得分:0)

该错误表示您的布局不是ViewGroup的王者。 接口[ChallengeLayout][1]将由您的ViewGroup实现,在这里,它似乎是SlidingChallengeLayout ...因此,请确保类SlidingChallengeLayout实现了ChallengeLayout

PS:ChallengeLayout不是公共API。确保您确实需要自定义Android ROM ...