Android Tutorial Material Design 2 - Using the AppCompat library

BarryW

Active Member
Licensed User
Longtime User
How can we hide the toolbar. It gives an error when IncludeTitle: False... Tnx
 

corwin42

Expert
Licensed User
Longtime User
How can we hide the toolbar. It gives an error when IncludeTitle: False... Tnx
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:

B4X:
<?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>
 

Scantech

Well-Known Member
Licensed User
Longtime 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?
 

corwin42

Expert
Licensed User
Longtime 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?

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

marcel

Active Member
Licensed User
Longtime User
Is it possible to use a button with an Icon/Image and text?
 

corwin42

Expert
Licensed User
Longtime User

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'.



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?
 

wimpie3

Well-Known Member
Licensed User
Longtime 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?
 

corwin42

Expert
Licensed User
Longtime 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?

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).
 

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
 

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
 

corwin42

Expert
Licensed User
Longtime 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
See the unfiltered logs if there is a real error message.
 

b4auser1

Well-Known Member
Licensed User
Longtime 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 ?
 

Attachments

  • sshot-2016-03-30-[16-33-55].png
    16.4 KB · Views: 623

trueboss323

Active Member
Licensed User
Longtime User
Hi corwin42,
Do you know if the current B4A 5.80 designer is compatible with the AppCompact?
 

corwin42

Expert
Licensed User
Longtime User
Hi corwin42,
Do you know if the current B4A 5.80 designer is compatible with the AppCompact?

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.
 

trueboss323

Active Member
Licensed User
Longtime 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?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…