arimorty / floatingsearchview

A search view that implements a floating search bar also known as persistent search
https://github.com/arimorty/floatingsearchview/blob/master/README.md
Apache License 2.0
3.54k stars 668 forks source link

Crashing in Android 4.3 #330

Open jabi1995 opened 4 years ago

jabi1995 commented 4 years ago

Error inflating when using in android 4.3

jabi1995 commented 4 years ago

Finally Found the answer This bug is for android sdk versions below 18, In order to correct this problem go through below instruction: 1) Download source code 2) Search for Util.class and xml files 3) Find getWrapperdDrawable method in Util.class 4) Replace this method with

public Drawable drawableGetter (@DrawableRes int id) {

if (android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.LOLLIPOP) {
  return AppCompatResources.getDrawable(getContext(), id);
}

return ContextCompat.getDrawable(getContext(), id);

}

5) Find any CardView in xml files and add below attributes to them app:cardPreventCornerOverlap="false" app:cardMaxElevation="0dp" app:cardElevation="0dp"

6) In Util.class find getHostActivity method and change return value of method to AppCompatActivity and do the necessary changes.