Skip to content

Fix for Right-To-Left language (Eg, Arabic)#59

Open
namanhams wants to merge 1 commit intoKaopiz:masterfrom
namanhams:master
Open

Fix for Right-To-Left language (Eg, Arabic)#59
namanhams wants to merge 1 commit intoKaopiz:masterfrom
namanhams:master

Conversation

@namanhams
Copy link
Copy Markdown

Fixes #58

@bouchnafamd
Copy link
Copy Markdown

This fix is not working

@behelit
Copy link
Copy Markdown

behelit commented Feb 8, 2017

I think you also need to apply similar logic to the updateBackground() method, so that it applies the margins correctly.
E.g:

        final boolean isLTR;
        isLTR = Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 ||     (TextUtils.getLayoutDirectionFromLocale(getContext().getResources().getConfiguration().locale) == LAYOUT_DIRECTION_LTR);

        LayoutParams initParams = (LayoutParams) child.getLayoutParams();
        LayoutParams params = new LayoutParams(initParams.width, initParams.height, initParams.weight);
        // Check orientation for proper margins
        if(getOrientation() == LinearLayout.HORIZONTAL)
        {
            if(isLTR)
            {
                params.setMargins(0, 0, -mMarginDp, 0);
            }
            else
            {
                params.setMargins(-mMarginDp, 0, 0, 0);
            }
        }
        else
        {
            params.setMargins(0, 0, 0, -mMarginDp);
        }
        child.setLayoutParams(params);

@dmsherazi
Copy link
Copy Markdown

@behelit Your snippet works to an extent but still the left radius of the first radiobutton.
whatsapp image 2017-04-09 at 3 21 38 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants