当我使用onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
时,问题是oncreateview
类中不存在Service
。
public class FloatingViewService extends Service{
CircleMenu circleMenu;
public FloatingViewService() {
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
//Inflate the floating view layout we created
mFloatingView = LayoutInflater
.from(this)
.inflate(R.layout.layout_floating_widget, null);
circleMenu = (CircleMenu) findViewById(R.id.circle_menu);
}
答案 0 :(得分:1)
尝试将最后一行更改为:
circleMenu = (CircleMenu) mFloatingView.findViewById(R.id.circle_menu);