Comments (10)
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.
i have a same.
but when i fix it.
invalidate();
requestLayout();
it is also invisible
from android-bootstrap.
Issue confirmed in latest version. For everyone waiting on a fix, the workaround is to define your BootstrapButton in XML.
from android-bootstrap.
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.
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.
ياخشى بىلىمكەن
from android-bootstrap.
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.
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.
(newbiee)
can you tell me how to add feature-v4 dependencies in gradle ?
from android-bootstrap.
@Narengowda just install 2.0.0 of the library, this issue should be resolved in there
from android-bootstrap.
Related Issues (20)
- How can I use Databinding for bootstrapText? HOT 1
- How can set data to BootstrapDropDown programmatically? HOT 1
- Font 'fontawesome-webfont-v470.ttf' not properly registered. HOT 2
- how to use custom color? HOT 1
- Update gradle dependencies HOT 1
- Making bootstrap button extend android.widget.button HOT 1
- app stopped when bootstrap dropdown inserted HOT 1
- Using Custom Fonts
- Bootstrap Dropdown doesn't work programmatically
- BootstrapProgressBar crashed when setting maxProgress
- BootstrapProgressBar
- landscape issue in bootstrap progress bar HOT 1
- Cannot show or hide Bootstrap button (visibility change) HOT 4
- radio button problem in a scroll view
- Rounded corners of ProgressBarGroup breaks if maximum
- .
- Cannot set background color
- .
- Compatibility with androidx HOT 1
- icons
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-bootstrap.