Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

namanhams
Copy link

Fixes #58

@bouchnafamd
Copy link

This fix is not working

@behelit
Copy link

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

@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