문제를 설명하는 것이 약간 어렵다고 생각하지만 시도하겠습니다. 여기에 클래스 코드안드로이드 프로그래밍의 단편
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
// TODO Auto-generated method stub
rootView = inflater.inflate(R.layout.search_doctor, container, false);
spinnerCity = (Spinner) rootView.findViewById(R.id.cityList);
클래스는 괜찮아요라고 처음의 한 부분이다 나는 조각을 확장하는 클래스를하고 난 추적 코드
frag = new SearchDoctor();
fragTransaction = getFragmentManager().beginTransaction().replace(R.id.container, frag);
fragTransaction.commit();
로 부른다. 하지만 다음 번에 "rootView = inflater.inflate (R.layout.search_doctor, container, false);"라인에서 thead exit라고 부릅니다. "
다른 레이아웃으로 여러 번 시도했기 때문에 search_doctor.xml (레이아웃)에 포함 된 조각에 문제가 있다는 것을 알고 있습니다. 문제가 발생했습니다. 여기
는 레이아웃 search_doctor.xml 누군가가 나를 도울 수 있다면<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Spinner
android:id="@+id/cityList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/city_arrays"
android:prompt="@string/city_prompt" />
<Button
android:id="@+id/btnSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/specialtyList"
android:layout_marginRight="16dp"
android:text="Αναζήτηση" />
<Spinner
android:id="@+id/specialtyList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/cityList"
android:entries="@array/specialty_arrays"
android:prompt="@string/specialty_prompt" />
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_below="@+id/btnSearch"
android:layout_marginTop="22dp"
class="com.google.android.gms.maps.SupportMapFragment" />
<ListView
android:id="@+id/resultList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/btnSearch"
android:layout_marginTop="22dp" >
</ListView>
<Button
android:id="@+id/btnMap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/resultList"
android:layout_alignParentLeft="true"
android:layout_marginLeft="16dp"
android:text="Χάρτης" />
</RelativeLayout>
나는 매우 기쁨을 드리겠습니다에게 있습니다. 미리 감사드립니다. 뷰 계층 구조에 문제가 유용 할 수 있습니다 그 경우
onCreateView()를 호출 하시겠습니까? – ChiefTwoPencils
@ChiefTwoPencils 나는 그것을 부르고 그것을 실행 중이다. 내가 쓴 것처럼 문제는 xml 파일의 단편에있다. –
수동으로 oncreateview를 호출한다고 하시겠습니까? – Breadbin