gpt4 book ai didi

java - MaskedEditText 使用 View.isInEditMode()

转载 作者:太空狗 更新时间:2023-10-29 14:56:52 25 4
gpt4 key购买 nike

我在使用 maskedEditText 时遇到以下错误图书馆:

enter image description here

我下载了库,然后我点击File->New->Other->Android project from existing Code-> Add folder,勾选copy project into workspace

然后我将库文件夹添加到我的项目中:

enter image description here

当我运行时出现 ClassNotFoundException

我的xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mask="http://schemas.android.com/apk/res/com.example.pppp"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.pppp.MainActivity" >

<br.com.sapereaude.maskedEditText.MaskedEditText
android:id="@+id/phoneNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:background="@null"
android:inputType="number"
mask:mask="(###) ###-##-##"
>
</br.com.sapereaude.maskedEditText.MaskedEditText>

</RelativeLayout>

错误

05-30 10:10:38.423: E/AndroidRuntime(32526): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pppp/com.example.pppp.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class br.com.sapereaude.maskedEditText.MaskedEditText
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.app.ActivityThread.access$600(ActivityThread.java:134)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.os.Looper.loop(Looper.java:154)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.app.ActivityThread.main(ActivityThread.java:4624)
05-30 10:10:38.423: E/AndroidRuntime(32526): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 10:10:38.423: E/AndroidRuntime(32526): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 10:10:38.423: E/AndroidRuntime(32526): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
05-30 10:10:38.423: E/AndroidRuntime(32526): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
05-30 10:10:38.423: E/AndroidRuntime(32526): at dalvik.system.NativeStart.main(Native Method)
05-30 10:10:38.423: E/AndroidRuntime(32526): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class br.com.sapereaude.maskedEditText.MaskedEditText
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.view.LayoutInflater.createView(LayoutInflater.java:608)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.view.LayoutInflater.rInflate(LayoutInflater.java:741)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
05-30 10:10:38.423: E/AndroidRuntime(32526): at com.example.pppp.MainActivity.onCreate(MainActivity.java:13)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.app.Activity.performCreate(Activity.java:4479)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
05-30 10:10:38.423: E/AndroidRuntime(32526): ... 11 more
05-30 10:10:38.423: E/AndroidRuntime(32526): Caused by: java.lang.reflect.InvocationTargetException
05-30 10:10:38.423: E/AndroidRuntime(32526): at java.lang.reflect.Constructor.constructNative(Native Method)
05-30 10:10:38.423: E/AndroidRuntime(32526): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
05-30 10:10:38.423: E/AndroidRuntime(32526): at android.view.LayoutInflater.createView(LayoutInflater.java:588)
05-30 10:10:38.423: E/AndroidRuntime(32526): ... 22 more
05-30 10:10:38.423: E/AndroidRuntime(32526): Caused by: java.lang.NoClassDefFoundError: br.com.sapereaude.maskedEditText.R$styleable
05-30 10:10:38.423: E/AndroidRuntime(32526): at br.com.sapereaude.maskedEditText.MaskedEditText.<init>(MaskedEditText.java:43)

最佳答案

尝试将命名空间更改为“MaskedEditText.MaskedEditText”。我们可以在“References/MaskedEditText”中看到命名空间。示例:

        <MaskedEditText.MaskedEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
mask:mask="+# (###) ##-##"
android:id="@+id/email" />

关于java - MaskedEditText 使用 View.isInEditMode(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30539323/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com