トグルボタン付きの画面を作成しようとしています。私はandroid2.2を使用しています。私はこの例外的な気持ちに悩まされている。トグルボタン付きアンドロイド画面
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="center_horizontal" android:id="@+id/postnatalcheck" android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#000000" android:paddingTop="10dip" android:paddingBottom="2dip">
<Button
android:id="@+id/buttonBackHome"
android:text="Home"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>
<ScrollView
android:id="@+id/scrollviewpostnatal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="70dip"
android:layout_marginBottom="15dip">
<LinearLayout
android:orientation="vertical" android:layout_height="fill_parent"
android:layout_width="fill_parent" >
<!-- This is Toggle button for PostNatal Check -->
<!-- this section is for Verbal examination Layout -->
<ToggleButton android:layout_width="fill_parent"
android:layout_height="wrap_content" android:textOff="Mother Verbal Examination"
android:textOn="Mother Verbal Examination" android:id="@+id/mverbalexamination" />
<LinearLayout
android:id="@+id/verexamination"
android:orientation="vertical" android:layout_height="fill_parent"
android:layout_marginLeft="25dip" android:layout_width="fill_parent" android:visibility="gone">
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Number of full meals in a day " android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/noofmeals"
android:layout_height="wrap_content"
android:prompt="@string/Mealsaday"
android:entries="@array/Numbers"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Experience excessive bleeding" android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/excessivebleeding"
android:layout_height="wrap_content"
android:prompt="@string/Excessbleeding"
android:entries="@array/Desicion"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Number of pads changed in a day " android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/noofpadschange"
android:layout_height="wrap_content"
android:prompt="@string/Noofpadschanged"
android:entries="@array/Numbers"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Baby kept warm*(during winter especially)" android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/bwarm"
android:layout_height="wrap_content"
android:prompt="@string/Bwarm"
android:entries="@array/Desicion"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Number of time baby is fed in a day " android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/bfed"
android:layout_height="wrap_content"
android:prompt="@string/Bfed"
android:entries="@array/Numbers"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Baby crying incessantly" android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/bcrying"
android:layout_height="wrap_content"
android:prompt="@string/Bcrying"
android:entries="@array/Desicion"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Number of times baby urinating in a day " android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/burinating"
android:layout_height="wrap_content"
android:prompt="@string/Burinating"
android:entries="@array/Numbers"
android:layout_width="fill_parent">
</Spinner>
</LinearLayout>
<!-- this section is for Verbal examination Layout ends here -->
<!-- this section is for Physical examination starts here -->
<ToggleButton
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:textOff="Mother Physical Examination"
android:textOn="Mother Physical Examination" android:id="@+id/mphysicalexamination" />
<LinearLayout
android:id="@+id/phyexamination"
android:orientation="vertical" android:layout_height="fill_parent"
android:layout_marginLeft="25dip" android:layout_width="fill_parent" android:visibility="gone">
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Body temperature " android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/mtemperature"
android:layout_height="wrap_content"
android:prompt="@string/Mtemperature"
android:entries="@array/Temperature"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Discharge smells foul" android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/mdischargesmell"
android:layout_height="wrap_content"
android:prompt="@string/Mdischarge"
android:entries="@array/Desicion"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Speaks abnormaly" android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/mspeakingpattern"
android:layout_height="wrap_content"
android:prompt="@string/Mspeakingpattern"
android:entries="@array/Desicion"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Having fits " android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/mfits"
android:layout_height="wrap_content"
android:prompt="@string/Mfits"
android:entries="@array/Desicion"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Percieves less/no milk " android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/mbreastmilk"
android:prompt="@string/Mbreastmilk"
android:entries="@array/Desicion"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Cracked nipples " android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/mnipples"
android:layout_height="wrap_content"
android:prompt="@string/Mnipples"
android:entries="@array/Desicion"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Looks pale" android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/mskincolor"
android:prompt="@string/Mskincolor"
android:entries="@array/Desicion"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
</Spinner>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Vaginal tearing " android:gravity="left" android:layout_gravity="left"/>
<Spinner
android:id="@+id/mvaginatearing"
android:entries="@string/Mvaginaltearing"
android:prompt="@array/Desicion"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
</Spinner>
</LinearLayout>
<!-- this section of physical examination ends here -->
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="left" android:layout_gravity="left"/>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="left" android:layout_gravity="left"/>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="left" android:layout_gravity="left"/>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="left" android:layout_gravity="left"/>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="left" android:layout_gravity="left"/>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="left" android:layout_gravity="left"/>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:gravity="left" android:layout_gravity="left"/>
<Button
android:id="@+id/buttonAdvisoryandSave"
android:text="Register"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/copyrighted"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
style="@style/copyrighted"
android:layout_below="@+id/rlinner"
android:text="@string/copyrighted"
android:textColor="#FFFFFF"/>
</RelativeLayout>
私logtrace:
/AndroidRuntime( 356): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.accenturelabs.idoc/com.accenturelabs.id
c.PostNatalCheck}: android.view.InflateException: Binary XML file line #198: Error inflating class <unknown>
/AndroidRuntime( 356): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
/AndroidRuntime( 356): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
/AndroidRuntime( 356): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
/AndroidRuntime( 356): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
/AndroidRuntime( 356): at android.os.Handler.dispatchMessage(Handler.java:99)
/AndroidRuntime( 356): at android.os.Looper.loop(Looper.java:123)
/AndroidRuntime( 356): at android.app.ActivityThread.main(ActivityThread.java:4627)
/AndroidRuntime( 356): at java.lang.reflect.Method.invokeNative(Native Method)
/AndroidRuntime( 356): at java.lang.reflect.Method.invoke(Method.java:521)
/AndroidRuntime( 356): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
/AndroidRuntime( 356): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
/AndroidRuntime( 356): at dalvik.system.NativeStart.main(Native Method)
/AndroidRuntime( 356): Caused by: android.view.InflateException: Binary XML file line #198: Error inflating class <unknown>
/AndroidRuntime( 356): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
/AndroidRuntime( 356): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
/AndroidRuntime( 356): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
/AndroidRuntime( 356): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
/AndroidRuntime( 356): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
/AndroidRuntime( 356): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
/AndroidRuntime( 356): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
/AndroidRuntime( 356): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
/AndroidRuntime( 356): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
/AndroidRuntime( 356): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
/AndroidRuntime( 356): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
/AndroidRuntime( 356): at android.app.Activity.setContentView(Activity.java:1647)
/AndroidRuntime( 356): at com.accenturelabs.idoc.PostNatalCheck.onCreate(PostNatalCheck.java:39)
/AndroidRuntime( 356): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
/AndroidRuntime( 356): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
/AndroidRuntime( 356): ... 11 more
/AndroidRuntime( 356): Caused by: java.lang.reflect.InvocationTargetException
/AndroidRuntime( 356): at android.widget.Spinner.<init>(Spinner.java:49)
/AndroidRuntime( 356): at java.lang.reflect.Constructor.constructNative(Native Method)
/AndroidRuntime( 356): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
/AndroidRuntime( 356): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
/AndroidRuntime( 356): ... 25 more
/AndroidRuntime( 356): Caused by: java.lang.NullPointerException
/AndroidRuntime( 356): at android.content.res.AssetManager.getResourceTextArray(AssetManager.java:213)
/AndroidRuntime( 356): at android.content.res.Resources.getTextArray(Resources.java:361)
/AndroidRuntime( 356): at android.content.res.TypedArray.getTextArray(TypedArray.java:628)
/AndroidRuntime( 356): at android.widget.AbsSpinner.<init>(AbsSpinner.java:73)
/AndroidRuntime( 356): at android.widget.Spinner.<init>(Spinner.java:53)
/AndroidRuntime( 356): ... 29 more
/ActivityManager( 58): Force finishing activity com.accenturelabs.idoc/.PostNatalCheck
/ActivityManager( 58): Activity pause timeout for HistoryRecord{45030968 com.accenturelabs.idoc/.PostNatalCheck}
/Process ( 356): Sending signal. PID: 356 SIG: 9
/ActivityManager( 58): Process com.accenturelabs.idoc (pid 356) has died.
/ActivityManager( 58): Scheduling restart of crashed service com.accenturelabs.idoc/.LocalService in 5000ms
フィールドにショットがあります:マニフェストファイルにアクティビティを追加しましたか?私はしばしばこれを忘れる。 – dan