需要android.support.v4.app.fragment [英] required android.support.v4.app.fragment

查看:214
本文介绍了需要android.support.v4.app.fragment的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望你能帮助我与此有关。我是新进的Andr​​oid

i hope you can help me with this. i am new into android

我试图解决这个问题,但我不能

i am trying to solve this problem but i couldnt

当我宣布这个方法的问题

the problem when i declared this method

public void onNavigationDrawerItemSelected(int position) {

    // slide menue declaration
   Fragment fragment = null;
    switch (position) {
        case 0:
            fragment = new menu1_Fragment();
            break;
        case 1:
            fragment = new menu2_Fragment();
            break;
        case 2:
            fragment = new menu3_Fragment();
            break;

        default:
            break;
    }

它给我一个错误说需要android.support.v4.app.fragment

it give me an error saying required android.support.v4.app.fragment

推荐答案

在你的类的开始检查你的进口。我想会有一个导入android.app.Fragment; 。将其更改为导入android.support.v4.app.Fragment; 。也许错误是由延长,而不是支持片段android.app.Fragment的menuX_Fragments引起的。

Check your imports at the beginning of your classes. I guess there will be a import android.app.Fragment;. Change it to import android.support.v4.app.Fragment;. Maybe the error is caused by the menuX_Fragments which extend android.app.Fragment instead of the support fragment.

您可以使用进口android.support.v4.app.Fragment用于开发低版本的Andr​​oid应用程序,片段介绍了Android 3.0的。

You can use import android.support.v4.app.Fragment for developing apps for lower android versions, fragments are introduced in Android 3.0.

决定片段的一个版本,到处使用它。我猜你混不起来。

Decide for one version of fragments and use it everywhere. I guess you mixed it up.

这篇关于需要android.support.v4.app.fragment的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆