zaaach / CityPicker

:fire::fire::fire:城市选择、定位、搜索及右侧字母导航,类似美团 百度糯米 饿了么等APP选择城市功能
3.12k stars 588 forks source link

您好在activity中使用 但是报了库里面的错误能帮忙看下吗 #108

Open douhaopeng opened 1 year ago

douhaopeng commented 1 year ago

FATAL EXCEPTION: main Process: com.hzsoft.basedemo, PID: 17896 android.view.InflateException: Binary XML file line #7 in com.hzsoft.basedemo:layout/cp_dialog_city_picker: Binary XML file line #24 in com.hzsoft.basedemo:layout/cp_search_view: Error inflating class EditText Caused by: android.view.InflateException: Binary XML file line #24 in com.hzsoft.basedemo:layout/cp_search_view: Error inflating class EditText Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 2: TypedValue{t=0x2/d=0x7f030167 a=-1} at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:782) at android.widget.TextView.readTextAppearance(TextView.java:4078) at android.widget.TextView.(TextView.java:1138) at android.widget.EditText.(EditText.java:95) at android.widget.EditText.(EditText.java:91) at androidx.appcompat.widget.AppCompatEditText.(AppCompatEditText.java:97) at androidx.appcompat.widget.AppCompatEditText.(AppCompatEditText.java:92) at androidx.appcompat.app.AppCompatViewInflater.createEditText(AppCompatViewInflater.java:216) at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:133) at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1569) at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1620) at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:256) at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1116) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1052) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1016) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1178) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1139) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1318) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1174) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1139) at android.view.LayoutInflater.inflate(LayoutInflater.java:696) at android.view.LayoutInflater.inflate(LayoutInflater.java:548) at com.zaaach.citypicker.CityPickerDialogFragment.onCreateView(CityPickerDialogFragment.java:114) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3104) at androidx.fragment.app.DialogFragment.performCreateView(DialogFragment.java:510) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:524) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1899) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1817) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1760) at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:547) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:257) at android.app.ActivityThread.main(ActivityThread.java:8228) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1016)

douhaopeng commented 1 year ago

需要再application中添加android:theme="@style/DefaultCityPickerTheme" 不仅仅只需要在activity中添加