0
무엇이 문제입니까? 레이아웃을 부 풀릴 수있는 방법은 무엇입니까? 오류 메시지의 의미를 알지 못합니다. 도와주세요. 는 감사android inflate a fragment
오류 메시지
09-01 18:44:58.698: E/AndroidRuntime(20617): Caused by:
java.lang.IllegalArgumentException: Binary XML file line #7: Duplicate id 0x7f080002,
tag null, or parent id 0x0 with another fragment for com.example.testing.ListFragment
내 코드
public static class DummySectionFragment extends Fragment {
public DummySectionFragment() {
}
public static final String ARG_SECTION_NUMBER = "section_number";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.e("555", "hello");
return inflater.inflate(R.layout.main, null);
/*
TextView textView = new TextView(getActivity());
textView.setGravity(Gravity.CENTER);
Bundle args = getArguments();
textView.setText(Integer.toString(args.getInt(ARG_SECTION_NUMBER)));
return textView;*/
}
}
main.xml에
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<fragment
android:id="@+id/listFragment"
android:layout_width="150dip"
android:layout_height="match_parent"
android:layout_marginTop="?android:attr/actionBarSize"
class="com.example.testing.ListFragment" ></fragment>
<fragment
android:id="@+id/detailFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.example.testing.DetailFragment" >
<!-- Preview: [email protected]/details -->
</fragment>
</LinearLayout>
아차! 다음과 같은 이유로 귀하의 질문을 제출할 수 없습니다 :
귀하의 게시물은 코드 섹션을 설명하기에 컨텍스트가 많지 않습니다. 귀하의 시나리오를보다 명확하게 설명하십시오.