나는 listview에 3 개의 데이터베이스 테이블의 내용을 보여주는 안드로이드 앱을 썼다. 그 때문에 나는 세 가지 활동을 썼다. 그러나 타블렛 뷰로 인해 나는 액티비티 대신 단편을 사용하여 서로 옆에있는 두 개의 첫 번째 목록 뷰의 내용을 표시하기로 결정했습니다. 이를 위해 나는 조각을 관리에서 onCreate 메소드 액션 바 내 사용자를 추가하기위한 활동을하고 그것은 다음과 같은 레이아웃 대형 폴더의 레이아웃이 있습니다기존 기능을 동일한 기능과 레이아웃으로 조각화하려면 어떻게해야합니까?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false" >
<fragment
android:id="@+id/poemlist"
android:name="com.example.emampoems.poemTypeFragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2" />
<fragment
android:id="@+id/list"
android:name="com.example.emampoems.Index"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
및 관리자 조각의 레이아웃으로 다음을 넣어 레이아웃 폴더 : 그 후
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.example.emampoems.Index" />
I 단편은 2 명 개의 제 1 활성을 변경. 다만 교환과에 "조각 확장"과 같은 방법의 재정에 레이아웃을 넣어 조각의 oCreate로에서 onCreate 변경을 제외하고 그에 동일한 명령을 넣어 "활동을 확장"
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.activity_index, container, false);
}
내 조각을 사용할 것을 함께 생각 이전 액티비티의 레이아웃 하지만 난 그것을 실행하면 다음과 같은 오류가 발생합니다 : 활동을 시작할 수 없습니다 componentInfo..android.view.inflatEException : 이진 XML 파일 라인 # 8 : 클래스 조각을 부 풀리는 중에 오류가 발생했습니다. 나는이 오류를 봤어.하지만 아무 대답도 나에게 도움이되지 않았어. 왜 그런 생각이 들립니까? 나는이 마이너스 befor이 질문을 무시하고 그들을 무시하고 만약 내가 내 질문에 옳은 방법으로 제발 제발 마이너스 제발 제거하십시오.
구성 한정자는 사용자가 살펴야 할 사항 중 하나입니다. http://developer.android.com/guide/practices/screens_support.html#qualifiers ProTip : 앱을 만들기 전에 전체 개발자 가이드를 읽어보십시오. – Timmetje
http://developer.android.com/guide/practices/screens_support.html에 문서가 있습니다. – njzk2