B4A Library AppCompat - Make Material Design apps compatible with older Android versions

Discussion in 'Additional libraries, classes and official updates' started by corwin42, Dec 19, 2014.

  1. corwin42

    corwin42 Expert Licensed User

    What do you want to do exactly? Make ACSearchView compatible with RTL languages?
  2. mshafiee110

    mshafiee110 Active Member Licensed User

    yes,I want to,ACSearchView is compatible with rtl language.and move from right to left.
    I changed the gravity of MSMaterialDrawer,from left to right with xml files.but i am unable to change gravity of ACSearchView.
    MSMaterialDrawer(change gravity from left to right)
  3. joneden

    joneden Active Member Licensed User

  4. joneden

    joneden Active Member Licensed User

    Sorry my bad, although it had worked I forgot that I needed to update the libs in the custom libs folder with the newer SDK files. I'm a dumbass

    3. Copy v4 and v7 support libraries from <...>\android-sdk\extras\android\support\v7\appcompat\libs to your CustomLibs folder
  5. migrec

    migrec Member Licensed User

    Hey @corwin42, with support library 23.1 setelevation method seem to not work.
    This is my code: AppCompat1.SetElevation(actionbar, 4dip) where actionbar is an ACToolbarDark
    if i Log appcompat1.getelevation(actionbar) i get 0
    is this something you could look at?
  6. FrankDev

    FrankDev Active Member Licensed User

    hi... is there an example for the ACSpinner ?
    is the font changeable ? (Name)
  7. shashkiranr

    shashkiranr Active Member Licensed User

    Hi All,

    I am using Theme.AppCompat.Light.NoActionBar as my parent theme. When the search view is activated, the back arrow is coming in black. I need to change the color to white. Any suggestions how to do that?

    Edit : I got it :)

    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name=
    "homeAsUpIndicator">@drawable/name  of the icon in resouce folder (the arrow image)</item>
    Last edited: Dec 27, 2015
  8. Reids

    Reids Member Licensed User

    I got error this while running the sample, no error while compiling, I've read every page on this thread, follow the instruction
    > update the latest sdk & android extra
    > makesure the latest b4a_appcompat file by deleting old file
    > copy android-support-v4.jar & android-support-v7-appcompat.jar to library folder
    > use android-sdk\platforms\android-23\android.jar while compiling
    but error still there, I don't know what I'm missing at

    threadid=1thread exiting with uncaught exception (group=0x419ecce0)
    EXCEPTION: main
    Process: de.amberhome.appcompat.example2, PID: 
    java.lang.NoSuchFieldError: android.support.v7.appcompat.R$styleable.ActionBarWindow
        at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:
        at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:
        at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:
        at de.amberhome.appcompat.example2.main.onCreate(main.java:
        at android.app.Activity.performCreate(
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
        at android.app.ActivityThread.access$
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
        at android.os.Handler.dispatchMessage(Handler.java:
        at android.os.Looper.loop(Looper.java:
        at android.app.ActivityThread.main(ActivityThread.java:
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
        at dalvik.system.NativeStart.main(Native Method)
      Force finishing 
    activity de.amberhome.appcompat.example2/.main
    max retries 4 of Token{41e84e58 ActivityRecord{41ffb368 u0 de.amberhome.appcompat.example2/.main t47 f}} appWin=Window{41e148a8 u0 Starting de.amberhome.appcompat.example2} drawState=4
    Screenshot failure taking screenshot for (720x1280) to layer 21015
    Received broadcast action=android.intent.action.PACKAGE_ADDED and uri=de.amberhome.appcompat.example2
    I google up "java.lang.NoSuchFieldError: android.support.v7.appcompat.R$styleable.ActionBarWindow" maybe problem with android-support-v7-appcompat.jar?
    but I already using the latest android-support-v7-appcompat.jar
  9. androh

    androh Member Licensed User

    Is AppCompat.SetClickEffect method working?
    I don't see any effect.
  10. corwin42

    corwin42 Expert Licensed User

    Yes, see attached project.

    Attached Files:

    androh likes this.
  11. androh

    androh Member Licensed User

    I want to ripple effect on switch view. But including text, whole row.
    How can I do that?

    Edit: That's ok. I did that very easy with your example :)
    Example attached.

    Attached Files:

    Last edited: Jan 12, 2016
  12. migrec

    migrec Member Licensed User

    I recently wrote that setelevation is not working with support lib 23.1 installed.
    And this doesn't work either:
    actionbar.PopupTheme = actionbar.THEME_LIGHT
    Does anyone have knowledge regarding this issue?
  13. corwin42

    corwin42 Expert Licensed User

    Be aware that SetElevation() does not work with every View. If it does not work with the View you want then you can put the view on a Panel and set the elevation for the Panel.

    PopupTheme should work. Please provide an example project to show that it does not work. I don't have time to create a testcase myself for all bug reports.
    migrec likes this.
  14. migrec

    migrec Member Licensed User

    Solved the popup theme just by changing the theme from .noactionbar to theme.appcompat.light, but about the setelevation, it doesnt even work with the toolbar, i remeber it did before.
  15. corwin42

    corwin42 Expert Licensed User

    It should work with the ToolBar. Be aware that it only works on Android 5.0 and above.
  16. shashkiranr

    shashkiranr Active Member Licensed User

    Hi All,

    I want to use a drawable for the thumb of the seekbar, how should one write the xml attributes to change it? I was referring to the google doc in the below link but I am getting an xml error.


    I am using the sample theme given in the example.
    Any suggestions appreciated. Need to change the seekbar thumb drawable using xml attribute
  17. migrec

    migrec Member Licensed User

    Sorry but it doesn't, my phone is running 6.0.1 it works with a few other views but not the toolbar
  18. Alisson

    Alisson Active Member Licensed User

    corwin2 your exemple result the error in the xml:


    This my manifest editor:


    This is my code xml:

    <?xml version="1.0" encoding="utf-8"?>
      ~ Copyright (C) 
    2015 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-
      ~ Unless required by applicable law 
    or agreed to in writing, software
      ~ distributed under the License 
    is distributed on an "AS IS" BASIS,
    OR CONDITIONS OF ANY KIND, either express or implied.
      ~ See the License 
    for the specific language governing permissions and
      ~ limitations under the License.


        <style name=
    "Base.Theme.AppCompat" parent="Base.V22.Theme.AppCompat" />
        <style name=
    "Base.Theme.AppCompat.Light" parent="Base.V22.Theme.AppCompat.Light" />

        <style name=
    "Base.V22.Theme.AppCompat" parent="Base.V21.Theme.AppCompat">
            <item name=

        <style name=
    "Base.V22.Theme.AppCompat.Light" parent="Base.V21.Theme.AppCompat.Light">
            <item name=

    You know solve the error?

    I wait your feedback.

    Thanks very much!
  19. corwin42

    corwin42 Expert Licensed User

    A workaround would be to place the Toolbar on a panel and elevate the panel.

    No. Everything I can say is that there is an error in your setup. Please check that really everything is up to date and that you use v23 android.jar. See the troubleshooting guide in the first post of the Appcompat library thread.
    lemonisdead and DonManfred like this.
  20. Alisson

    Alisson Active Member Licensed User

    Corwin42, thanks very much!!
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice