Comments (7)
Can you please post a code snippet that can be used to reproduce this behaviour?
from android-bootstrap.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:clipToPadding="false"
android:fitsSystemWindows="true"
xmlns:card="http://schemas.android.com/apk/res-auto"
android:paddingTop="5dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/my_third" >
<include layout="@layout/fragment_button" />
</LinearLayout>
</ScrollView>
fragment_button:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/widget191"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.beardedhen.androidbootstrap.BootstrapButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/xxx"
bootstrapbutton:bb_icon_left="fa-check-square-o"
bootstrapbutton:bb_icon_right="fa-hand-o-right"
bootstrapbutton:bb_roundedCorners="true"
bootstrapbutton:bb_type="primary"
android:paddingBottom="5dp"
android:paddingTop="5dp"/>
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/about"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about"
bootstrapbutton:bb_icon_left="fa-info-circle"
bootstrapbutton:bb_icon_right="fa-hand-o-right"
bootstrapbutton:bb_roundedCorners="true"
bootstrapbutton:bb_type="primary"
android:paddingBottom="5dp"
/>
...
from android-bootstrap.
This bug occurs when a BootstrapButton has a layout_width of match parent or uses weighting. The middle label occludes the right icon - setting its width to wrap_content breaks the text alignment code.
This may require a bit of time to fix as it looks like the layout will need to be switched to a RelativeLayout, and the label padding/text alignment code will also need changing.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:duplicateParentState="true"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="10dp">
<TextView
android:id="@+id/lblLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="15dp"
android:visibility="gone" />
<TextView
android:id="@+id/lblMiddle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:visibility="gone" />
<TextView
android:id="@+id/lblRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingRight="15dp"
android:visibility="gone" />
</LinearLayout>
from android-bootstrap.
Hello,
If it is not something urgent in 2 weeks I will be free and as I said before I was thinking of making rotating button icons. In order to make them I already enhanced the padding/margin calculations. So my local probably will solve this issue as well. Or if someone is working on it I can wait.
from android-bootstrap.
I haven't looked into this yet, but it's possible I might get a chance over the next few weeks. If I do start work on it I'll leave a comment in here, as there's no point duplicating effort. Rotating icons would also be very welcome.
from android-bootstrap.
- I also ran into this issue in my Nexus 4 (OS Android 5.0).
- After struggling a day of modifying and testing, following changes for the lblMiddle in the button Layout fixed my problem, hope it will be helpful:
android:layout_width="0dp"
android:layout_weight="1" - The whole layout of the button
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:duplicateParentState="true"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="10dp">
<TextView
android:id="@+id/lblLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="15dp"
android:visibility="gone" />
<TextView
android:id="@+id/lblMiddle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:visibility="gone"
android:layout_weight="1"
/>
<TextView
android:id="@+id/lblRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingRight="15dp"
android:visibility="gone" />
</LinearLayout>
- And I found an article is really helpful to understand it:
http://randomlytyping.com/blog/2014/2/9/matchparent-vs-fillparent
from android-bootstrap.
@ian2009 thanks for your fix, I'll try and test it out at some point over the next few days. Would you mind creating a PR?
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.