台灣最大程式設計社群網站
線上人數
826
 
會員總數:244895
討論主題:188889
歡迎您免費加入會員
討論區列表 >> Android APP 開發 >> 搜尋框顯示歷史紀錄,套件無法套用?
[]  
[我要回覆]
1
回應主題 加入我的關注話題 檢舉此篇討論 將提問者加入個人黑名單
搜尋框顯示歷史紀錄,套件無法套用?
價值 : 300 QP  點閱數:154 回應數:3

樓主

studycode
門外漢
0 42
1725 79
發送站內信

公司app的搜尋框要新增顯示歷史紀錄,
google到一個範例 https://github.com/wozhizhizhi/searchlayout_weight,
自己新開一個專案練習,import他裡面的class 「searchlayoutview」,並調整好layout,很順利地可以使用!!
但是放到公司的app就一直閃退!!

有查到問題可能是因為AppTheme是"android:Theme.Holo.Light.DarkActionBar" 所引起的,
因此在練習的專案,將AppTheme由"Theme.AppCompat.Light.DarkActionBar"改為"android:Theme.Holo.Light.DarkActionBar",真的就閃退,
但將公司app的AppTheme改為"Theme.AppCompat.Light.DarkActionBar"一樣是不行呀~還是閃退~
style.xml如下,請問是不是我還得改其他設定??還是我需要調整的不是style??
---------------------------
<?xml version="1.0" encoding="utf-8"?>

<resources>

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar" >
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:actionMenuTextAppearance">@style/MyActionBar.MenuTextStyle</item>
<item name="android:itemTextAppearance">@style/MyActionBar.ActionBarOverflow</item>
</style>

<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:background">@color/action_bar</item>
<item name="android:titleTextStyle">@style/MyActionBar.TitleTextStyle</item>
<!--
<item name="android:displayOptions">showHome|useLogo</item>
-->
</style>

<style name="MyActionBar.TitleTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">18sp</item>
</style>

<style name="MyActionBar.MenuTextStyle">
<item name="android:textSize">18sp</item>
</style>

<style name="MyActionBar.ActionBarOverflow" parent="@android:style/Widget.ActionButton.Overflow">
<item name="android:textSize">20sp</item>
</style>

<style name="progressBar" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:background">@null</item>
<item name="android:windowBackground">@null</item>
<item name="android:backgroundDimEnabled">false</item>
</style>

<style name="customDialog" parent="android:Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>

<style name="bunttonStyle">
<item name="android:background">@drawable/round_corners_button</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:minHeight">0dp</item>
<item name="android:minWidth">0dp</item>
</style>

<style name="bunttonStyle2">
<item name="android:background">@drawable/round_corners_button2</item>
<item name="android:paddingLeft">20dp</item>
<item name="android:paddingRight">20dp</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:minHeight">0dp</item>
<item name="android:minWidth">0dp</item>
</style>

<style name="bunttonStyle3">
<item name="android:background">@drawable/round_corners_button3</item>
<item name="android:paddingLeft">20dp</item>
<item name="android:paddingRight">20dp</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:minHeight">0dp</item>
<item name="android:minWidth">0dp</item>
</style>

<style name="DialogText">
<item name="android:textColor">#FF000000</item>
<item name="android:textSize">18sp</item>
</style>

<style name="DialogText.Title">
<item name="android:textSize">18sp</item>
<item name="android:textStyle">bold</item>
</style>

</resources>
---------------------------

搜尋相關Tags的文章: [ 歷史紀錄 ] , [ search ] , [ 閃退 ] ,
本篇文章發表於2019-06-24 09:42
別忘捐VP感謝幫助你的人 新手會員瞧一瞧
1樓
回應

kkk1
檢舉此回應
能貼上LOGCAT 看看原因麻
本篇文章回覆於2019-06-24 11:53
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
2樓
作者回應

studycode
檢舉此回應
logcat很多,不知道主要的是不是以下這段,是我點了套用的搜尋框,閃退的log:

--------- beginning of crash
2019-06-25 08:52:33.907 8173-8173/com.sngen.shop E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sngen.shop, PID: 8173
android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.widget.ResourceCursorAdapter.newView(ResourceCursorAdapter.java:135)
at android.widget.CursorAdapter.getView(CursorAdapter.java:285)
at android.widget.AbsListView.obtainView(AbsListView.java:2366)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1408)
at android.widget.ListView.onMeasure(ListView.java:1315)
at com.aji.searchlayoutview.SearchListView.onMeasure(SearchListView.java:30)
at android.view.View.measure(View.java:23169)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
at android.view.View.measure(View.java:23169)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1308)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.widget.ScrollView.onMeasure(ScrollView.java:350)
at android.view.View.measure(View.java:23169)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
at android.view.View.measure(View.java:23169)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1187)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:706)
at android.view.View.measure(View.java:23169)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:23169)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:23169)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23169)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
at android.view.View.measure(View.java:23169)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
at android.view.View.measure(View.java:23169)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2718)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1572)
2019-06-25 08:52:33.908 8173-8173/com.sngen.shop E/AndroidRuntime: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1855)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7183)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
at android.view.Choreographer.doCallbacks(Choreographer.java:761)
at android.view.Choreographer.doFrame(Choreographer.java:696)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f03016b a=-1}
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:946)
at android.content.res.TypedArray.getDrawable(TypedArray.java:930)
at android.view.View.<init>(View.java:5010)
at android.view.ViewGroup.<init>(ViewGroup.java:659)
at android.widget.LinearLayout.<init>(LinearLayout.java:244)
at android.widget.LinearLayout.<init>(LinearLayout.java:240)
at android.widget.LinearLayout.<init>(LinearLayout.java:236)
... 69 more
本篇文章回覆於2019-06-25 09:20
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
3樓
作者回應

studycode
檢舉此回應
已解決!!
在AndroidMainifest.xml把Activity的theme屬性拿掉就ok了!!@@
本篇文章回覆於2019-06-25 12:32
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
   
1

回覆
如要回應,請先登入.