Git Product home page Git Product logo

Comments (10)

theDazzler avatar theDazzler commented on May 18, 2024

Assuming all of your code is correct, the problem may be caused by BootstrapButton not calling invalidate() and
requestLayout() in its methods where the view is changed. For example, this method:

public void setBootstrapType(String bootstrapType) {

                BootstrapTypes type = null;

                //get the correct background type
                if (roundedCorners == true) {
                        type = bbuttonTypeMapRounded.get(bootstrapType);
                } else {
                        type = bbuttonTypeMap.get(bootstrapType);
                }

                //set up as default
                if (type == null) {
                        type = BootstrapTypes.DEFAULT;
                }


                layout.setBackgroundResource(type.backgroundDrawable);
                lblLeft.setTextColor(getResources().getColor(type.textColour));
                lblMiddle.setTextColor(getResources().getColor(type.textColour));
                lblRight.setTextColor(getResources().getColor(type.textColour));

        }

might need to be:

public void setBootstrapType(String bootstrapType) {

                BootstrapTypes type = null;

                //get the correct background type
                if (roundedCorners == true) {
                        type = bbuttonTypeMapRounded.get(bootstrapType);
                } else {
                        type = bbuttonTypeMap.get(bootstrapType);
                }

                //set up as default
                if (type == null) {
                        type = BootstrapTypes.DEFAULT;
                }


                layout.setBackgroundResource(type.backgroundDrawable);
                lblLeft.setTextColor(getResources().getColor(type.textColour));
                lblMiddle.setTextColor(getResources().getColor(type.textColour));
                lblRight.setTextColor(getResources().getColor(type.textColour));

                invalidate();
                requestLayout();

        }

See this link:http://developer.android.com/training/custom-views/create-view.html and look at the heading "Add Properties and Events". This isn't your fault. It's a bug in the code.

from android-bootstrap.

alexliyu avatar alexliyu commented on May 18, 2024

i have a same.
but when i fix it.
invalidate();
requestLayout();
it is also invisible

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on May 18, 2024

Issue confirmed in latest version. For everyone waiting on a fix, the workaround is to define your BootstrapButton in XML.

from android-bootstrap.

qgadrian avatar qgadrian commented on May 18, 2024

Still not fixed?

I tried to create a new button programatically but doesn't show text.

XML workaround only works if you know the buttons, but if you don't know how many buttons will be created that doesn't help.

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on May 18, 2024

Feel free to create a PR if you can identify the issue. The XML workaround should work fine, just create a LayoutInflater then inflate views in a loop depending on how many buttons you need.

from android-bootstrap.

huxqiray avatar huxqiray commented on May 18, 2024

ياخشى بىلىمكەن

from android-bootstrap.

allenc2014 avatar allenc2014 commented on May 18, 2024

unfortunately, looks like this is still an issue with the latest version.

there are a lot of initialization code being called in the initialize() method, which is by-passed if XML is not used to create the button in the first place.

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on May 18, 2024

I believe I've fixed this in the feature-v4 branch, which is a major update for Bootstrap v4. Until then it's probably best to inflate from XML.

from android-bootstrap.

Narengowda avatar Narengowda commented on May 18, 2024

(newbiee)
can you tell me how to add feature-v4 dependencies in gradle ?

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on May 18, 2024

@Narengowda just install 2.0.0 of the library, this issue should be resolved in there

from android-bootstrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.