How to right align PreferencesActivity in android?

前端 未结 14 2251
一向
一向 2020-12-31 07:07

I have PreferencesActivity which I need it to be right aligned because I want to use Arabic language, I tried to use android:layout_gravity=\"right\"

14条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-31 08:01

    create a layout xml file called preference_checkbox.xml paste this (change the colour to what you want, only the gravity and the width set to fill parent are important) :
    
    
    
    
    
        
    
        
    
    
    
    
    
    
    
    
    and then in the preferences xml file for each row in the settings list that you want to right align add this: android:layout="@layout/preference_checkbox"
    
    thats it!
    got the solution from : http://stackoverflow.com/questions/7094584/checkboxpreference-with-own-layout
    the question there was about check box with image but it's the same technique.
    Good Luck.
    

提交回复
热议问题