Android Tutorial Material Design 2 - Using the AppCompat library

Discussion in 'Tutorials & Examples' started by corwin42, Dec 19, 2014.

  1. BarryW

    BarryW Active Member Licensed User

    How can we hide the toolbar. It gives an error when IncludeTitle: False... Tnx
     
  2. corwin42

    corwin42 Expert Licensed User

    Use a Theme without an ActionBar as your base theme like "Theme.AppCompat.Light.NoActionBar"

    Or you can disable the ActionBar in the theme like here:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name=
    "MyAppTheme" parent="Theme.AppCompat.Light">
            <item name=
    "colorPrimary">#FF9800</item>
            <item name=
    "colorPrimaryDark">#F57C00</item>
            <item name=
    "colorAccent">#FFA726</item>
            <item name=
    "windowNoTitle">true</item>
            <item name=
    "windowActionBar">false</item>
        </style>
    </resources>
     
    Erel and DonManfred like this.
  3. Scantech

    Scantech Active Member Licensed User

    Thanks, that did the trick for my Main. # includetitle has to be true. That poses a problem on my other Activities. I want them with the Titles. Any workaround for this?
     
  4. corwin42

    corwin42 Expert Licensed User

    Use different Themes for your activities. See this thread how this is done.
     
  5. palmzac

    palmzac Active Member Licensed User

    It's GREAT Lib. Would you give us a more examples ? Thank you !
     
  6. marcel

    marcel Active Member Licensed User

    Is it possible to use a button with an Icon/Image and text?
     
  7. corwin42

    corwin42 Expert Licensed User

    There is no such feature in the AppCompat library.
     
  8. Alisson

    Alisson Active Member Licensed User

    I have the error:
    Generating R file. Error
    d:\android\android-sdk\extras\android\support\v7\appcompat\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

    upload_2016-1-15_10-5-53.png

    My xml file:

    <?xml version="1.0" encoding="utf-8"?>
    <!--
    Copyright (C) 2014 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-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    -->

    <resources>

    <style name="Base.Widget.AppCompat.Button.Colored" parent="android:Widget.Material.Button.Colored" />

    </resources>


    How can I do it?
     
  9. corwin42

    corwin42 Expert Licensed User

    DonManfred likes this.
  10. wimpie3

    wimpie3 Active Member Licensed User

    Is it possible to switch between a hamburger icon and the back button in the toolbar (animated), just like it is done in the Gmail app?
     
  11. corwin42

    corwin42 Expert Licensed User

    Yes, there are several libraries with which you can add this effect.

    AHNavigationdrawer (Navigation drawer which includes an animated hamburger->arrow drawable)
    MSMaterialDrawer (Simple to use Navigation drawer which automatically includes this effect. Recommended)
    MSMaterialMenu (Drawable with the animated icon).
     
  12. JNG

    JNG Member Licensed User

    I am getting error
    Unfortunately Appcompact1 has while installing on sdk 23

    Path defined as
    #AdditionalRes: D:\b4alib1392014\b4aresources\b4a_appcompat, de.amberhome.objects.appcompat
    #AdditionalRes:C:\android\sdk\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
    #Extends: android.support.v7.app.ActionBarActivity

    Path in configure path is

    C:\android\sdk\platforms\android-23\android.jar

    pl. advise where I am wrong
     
  13. DonManfred

    DonManfred Expert Licensed User

    THIS is the exact error message from the log???
     
  14. JNG

    JNG Member Licensed User

    On Phone Unfortunately Appcompact1 has Stopped while installing on sdk 23
    below is the log message :
    LogCat connected to: ZY2224PCGQ
    --------- beginning of crash
    --------- beginning of system
    --------- beginning of main
     
  15. corwin42

    corwin42 Expert Licensed User

    See the unfiltered logs if there is a real error message.
     
  16. b4auser1

    b4auser1 Well-Known Member Licensed User

    I tried to compile and start AppCompatExample1 on Android KK and newer versions. On LL and MM EditText and Spinner have Material Design style. But on KK do not (see attached screenshot), though other views with MD style. How to resolve the issue ?
    And another question - CheckBox with MD has Black/White colors. Before it was Blue/White colors. How to confogure colors for CheckBox in theme.xml ?
     

    Attached Files:

  17. corwin42

    corwin42 Expert Licensed User

    Just read the tutorial.
     
    Peter Simpson and b4auser1 like this.
  18. trueboss323

    trueboss323 Active Member Licensed User

    Hi corwin42,
    Do you know if the current B4A 5.80 designer is compatible with the AppCompact?
     
  19. corwin42

    corwin42 Expert Licensed User

    Yes. AppCompat Library is compatible with the current B4A version designer but it currently does not support the new custom properties feature of the designer. I'm currently working on it.
     
    Peter Simpson likes this.
  20. trueboss323

    trueboss323 Active Member Licensed User

    Alright, because I am using B4A 5.8 but I am still having that same problem with the radio buttons and checkboxes being in black color when I test it on Android 4.x. Is there currently a fix for this?
     
Loading...
  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