Giter Club home page Giter Club logo

Comments (7)

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

Can you please post a code snippet that can be used to reproduce this behaviour?

from android-bootstrap.

kamilwlf avatar kamilwlf commented on May 20, 2024
<?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.

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

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.

fmakdemir avatar fmakdemir commented on May 20, 2024

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.

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

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.

ian2009 avatar ian2009 commented on May 20, 2024
  • 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>

from android-bootstrap.

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

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

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.