How To Specify Fixed Layout_marginleft For Smartphones And Wrap_content For Tablet For Navigationdrawer
I have the below navigation drawer and I want to give layout_marginLeft as -64dp for smartphones and wrap_content for tablets. Please let me know how to do that?I don't want to c
Solution 1:
Assuming that you know how to create different dimes.xml
files for multiple screens (If you don't know that have a look in How to define dimens.xml for every different screen size in android?) your problem should be how to set android:layout_marginLeft
in the specific xml file using dimen value.
You can try this way
for wrap_content
>
<dimen name="your_value">-2dp</dimen>
for match_parent
>
<dimen name="your_value">-1dp</dimen>
and set android:layout_marginLeft="@dimen/your_value"
Solution 2:
You Just have to create 5 layouts file for all screen sizes with same name(of layout file) and store it into different folder In (hdpi,mdpi,xhdpi,xxhdpi,xxxhdpi).
Post a Comment for "How To Specify Fixed Layout_marginleft For Smartphones And Wrap_content For Tablet For Navigationdrawer"