计算器应用程序在android.support.v4.view.ViewPager

时间:2015-10-03 18:18:21

标签: java android android-fragments android-activity nullpointerexception

我开发了一个Calcualtor应用程序。遗憾的是,该应用程序无法启动,例外情况为“android.support.v4.view.ViewPager。不确定这个问题究竟是什么以及导致问题的原因。

java.lang.NullPointerException
    at android.support.v4.view.ViewPager.getChildDrawingOrder(ViewPager.java:681)
    at android.view.ViewGroup.buildOrderedChildList(ViewGroup.java:3314)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3189)
    at android.view.View.draw(View.java:15117)
    at android.support.v4.view.ViewPager.draw(ViewPager.java:2259)
    at android.view.View.draw(View.java:15022)
    at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404)
    at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15017)
    at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404)
    at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15017)
    at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404)
    at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15117)
    at android.view.View.draw(View.java:15022)
    at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404)
    at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15117)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:587)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:334)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
    at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:708)
    at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:697)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
    at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:697)
    at com.android.tools.idea.rendering.RenderService.render(RenderService.java:816)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:646)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:82)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:589)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:584)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
    at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

activity_calculator_Port .xml

<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2014 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <include
        layout="@layout/display"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <shashank_balaganchi.calculator.CalculatorPadViewPager
        android:id="@+id/pad_pager"
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:overScrollMode="never">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <include layout="@layout/pad_numeric" />
            <include layout="@layout/pad_operator_one_col" />

        </LinearLayout>

        <include layout="@layout/pad_advanced" />

    </shashank_balaganchi.calculator.CalculatorPadViewPager>

</LinearLayout>

Log Cat文件在运行应用程序时说明

10-03 23:46:01.949  18129-18129/shashank_balaganchi.calculator E/dalvikvm﹕ Could not find class 'java.util.Locale$Builder', referenced from method shashank_balaganchi.calculator.CalculatorNumericPadLayout.onFinishInflate
10-03 23:46:01.949  18129-18129/shashank_balaganchi.calculator E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: shashank_balaganchi.calculator, PID: 18129
    java.lang.RuntimeException: Unable to start activity ComponentInfo{shashank_balaganchi.calculator/shashank_balaganchi.calculator.Calculator}: android.view.InflateException: Binary XML file line #26: Error inflating class android.widget.Button
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
            at android.app.ActivityThread.access$800(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5052)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class android.widget.Button
            at android.view.LayoutInflater.createView(LayoutInflater.java:623)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
            at android.view.LayoutInflater.parseInclude(LayoutInflater.java:842)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:748)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
            at android.app.Activity.setContentView(Activity.java:1946)
            at shashank_balaganchi.calculator.Calculator.onCreate(Calculator.java:124)
            at android.app.Activity.performCreate(Activity.java:5248)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
            at android.app.ActivityThread.access$800(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5052)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.reflect.InvocationTargetException
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            at android.view.LayoutInflater.createView(LayoutInflater.java:597)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
            at android.view.LayoutInflater.parseInclude(LayoutInflater.java:842)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:748)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
            at android.app.Activity.setContentView(Activity.java:1946)
            at shashank_balaganchi.calculator.Calculator.onCreate(Calculator.java:124)
            at android.app.Activity.performCreate(Activity.java:5248)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
            at android.app.ActivityThread.access$800(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5052)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.content.res.Resources$NotFoundException: File res/drawable/pad_button_background.xml from drawable resource ID #0x7f02003f
            at android.content.res.Resources.loadDrawable(Resources.java:2139)
            at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:348)
            at android.content.res.Resources.loadDrawable(Resources.java:2062)
            at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
            at android.view.View.<init>(View.java:3558)
            at android.widget.TextView.<init>(TextView.java:623)
            at android.widget.Button.<init>(Button.java:107)
            at android.widget.Button.<init>(Button.java:103)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            at android.view.LayoutInflater.createView(LayoutInflater.java:597)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
            at android.view.LayoutInflater.parseInclude(LayoutInflater.java:842)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:748)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
            at android.app.Activity.setContentView(Activity.java:1946)
            at shashank_balaganchi.calculator.Calculator.onCreate(Calculator.java:124)
            at android.app.Activity.performCreate(Activity.java:5248)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
            at android.app.ActivityThread.access$800(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5052)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #18: invalid drawable tag ripple
            at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:935)
            at android.graphics.drawable.Drawable.createFromXml(Drawable.java:879)
            at android.content.res.Resources.createFromXml(Resources.java:2515)
            at android.content.res.Resources.loadDrawable(Resources.java:2135)
            at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:348)
            at android.content.res.Resources.loadDrawable(Resources.java:2062)
            at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
            at android.view.View.<init>(View.java:3558)
            at android.widget.TextView.<init>(TextView.java:623)
            at android.widget.Button.<init>(Button.java:107)
            at android.widget.Button.<init>(Button.java:103)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            at android.view.LayoutInflater.createView(LayoutInflater.java:597)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
            at android.view.LayoutInflater.parseInclude(LayoutInflater.java:842)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:748)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
            at android.app.Activity.setContentView(Activity.java:1946)
            at shashank_balaganchi.calculator.Calculator.onCreate(Calculator.java:124)
            at android.app.Activity.performCreate(Activity.java:5248)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
            at android.app.ActivityThread.access$800(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5052)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
            at dalvik.system.NativeStart.main(Native Method)

Display.xml

<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2014 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/display"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/display_background_color"
    android:elevation="4dip">

    <shashank_balaganchi.calculator.CalculatorEditText
        android:id="@+id/formula"
        style="@style/DisplayEditTextStyle.Formula"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text|textNoSuggestions"
        android:textColor="@color/display_formula_text_color" />

    <shashank_balaganchi.calculator.CalculatorEditText
        android:id="@+id/result"
        style="@style/DisplayEditTextStyle.Result"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/formula"
        android:inputType="none"
        android:focusable="false"
        android:textColor="@color/display_result_text_color" />

</RelativeLayout>

Padadvance.xml

<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2014 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<shashank_balaganchi.calculator.CalculatorPadLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pad_advanced"
    style="@style/PadLayoutStyle.Advanced"
    android:background="@color/pad_advanced_background_color">

    <Button
        android:id="@+id/fun_sin"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_fun_sin"
        android:onClick="onButtonClick"
        android:text="@string/fun_sin" />

    <Button
        android:id="@+id/fun_cos"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_fun_cos"
        android:onClick="onButtonClick"
        android:text="@string/fun_cos" />

    <Button
        android:id="@+id/fun_tan"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_fun_tan"
        android:onClick="onButtonClick"
        android:text="@string/fun_tan" />

    <Button
        android:id="@+id/fun_ln"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_fun_ln"
        android:onClick="onButtonClick"
        android:text="@string/fun_ln" />

    <Button
        android:id="@+id/fun_log"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_fun_log"
        android:onClick="onButtonClick"
        android:text="@string/fun_log" />

    <Button
        android:id="@+id/op_fact"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_op_fact"
        android:onClick="onButtonClick"
        android:text="@string/op_fact" />

    <Button
        android:id="@+id/const_pi"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_const_pi"
        android:onClick="onButtonClick"
        android:text="@string/const_pi" />

    <Button
        android:id="@+id/const_e"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_const_e"
        android:onClick="onButtonClick"
        android:text="@string/const_e" />

    <Button
        android:id="@+id/op_pow"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_op_pow"
        android:onClick="onButtonClick"
        android:text="@string/op_pow" />

    <Button
        android:id="@+id/lparen"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_lparen"
        android:onClick="onButtonClick"
        android:text="@string/lparen" />

    <Button
        android:id="@+id/rparen"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_rparen"
        android:onClick="onButtonClick"
        android:text="@string/rparen" />

    <Button
        android:id="@+id/op_sqrt"
        style="@style/PadButtonStyle.Advanced"
        android:contentDescription="@string/desc_op_sqrt"
        android:onClick="onButtonClick"
        android:text="@string/op_sqrt" />

</shashank_balaganchi.calculator.CalculatorPadLayout>

padnumeric.xml

&LT;

?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2014 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<shashank_balaganchi.calculator.CalculatorNumericPadLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pad_numeric"
    style="@style/PadLayoutStyle.Numeric"
    android:background="@color/pad_numeric_background_color"
    android:columnCount="3"
    android:rowCount="4">

    <Button
        android:id="@+id/digit_7"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/digit_8"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/digit_9"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/digit_4"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/digit_5"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/digit_6"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/digit_1"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/digit_2"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/digit_3"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/dec_point"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/digit_0"
        style="@style/PadButtonStyle.Numeric"
        android:onClick="onButtonClick" />

    <Button
        android:id="@+id/eq"
        style="@style/PadButtonStyle.Numeric.Equals"
        android:contentDescription="@string/desc_eq"
        android:onClick="onButtonClick"
        android:text="@string/eq" />

</shashank_balaganchi.calculator.CalculatorNumericPadLayout>

1 个答案:

答案 0 :(得分:1)

res/drawable/pad_button_background.xml

缺少ID为#0x7f02003f

的资源