1

오류 : 'childFragmentManager'매개 변수는 android.support.v4.app.Fragment에서 getChildFragmentManager() 메서드를 사용할 수있는 경우에만 사용할 수 있습니다. 지원 라이브러리 버전을 업데이트하십시오.getChildFragmentManager() 메서드를 확인할 수 없습니다.

나는 내 gradle에서 'com.android.support:support-v4:24.2.0'을 컴파일했습니다. 내 코드는;

import android.support.v4.app.Fragment; 
import org.androidannotations.annotations.*; 
import org.androidannotations.annotations.sharedpreferences.Pref; 
. 
. 

@EFragment(R.layout.fragment_main) 
public class MainFragment extends Fragment { 
@Pref 
ApplicationSettings_ applicationSettings; 
@ViewById(R.id.bot) 
public LinearLayout bot; 
@ViewById(R.id.center) 
public LinearLayout center; 
@Bean 
UIItemGenerator uiItemGenerator; 
@SystemService 
LayoutInflater layoutInflater; 
@FragmentById(value = R.id.contentFragment,childFragment = true) 
public ContentFragment contentFragment; 

public MainFragment() { 
} 

@Click(R.id.imagebutton_ribbon) 
public void ribbonClick(View view) { 
    view.setVisibility(View.GONE); 
} 

. 
. 
. 
@AfterViews 
public void afterViews() { 
    if (contentFragment == null) 
     contentFragment = (ContentFragment) this.getChildFragmentManager().findFragmentById(R.id.contentFragment); 
    for (int j = 0; j < bot.getChildCount(); j++) { 
     bot.getChildAt(j).setSelected(false); 
    } 
    for (int j = 0; j < top.getChildCount(); j++) { 
     top.getChildAt(j).setSelected(false); 
    } 
    ll_home.setSelected(true); 
    ll_allrooms.setSelected(true); 
    initUI(); 
    contentFragment.generateContent(-1, -1); 
    imagebutton_top_rightarrow.setSelected(true); 
    imagebutton_bot_rightarrow.setSelected(true); 

답변

0

getChildFragmentManager는() 조각의 방법이며,이

getSupportFragmentManager() 
를 사용해야 난 당신이 AppCompatActivity (FragmentActivity의 하위 클래스)를 사용하는 생각 가져 오기 문

import android.support.v4.app.FragmentManager; 

을 확인

+0

그는 조각 활동이 아닌 조각을 확장합니다. 답변을 게시하기 전에 질문을주의 깊게 확인하십시오. –

+0

제 대답을 편집 해 주셔서 감사합니다 ,,,,, – GvSharma

관련 문제