Android Studio XML上的RTL预览

问题描述 投票:4回答:1

是否可以在Android Studio的XML预览中预览布局的RTL视图?

xml android-studio preview right-to-left
1个回答
7
投票

对于预览,您可以使用android:layoutDirection="rtl"设置xml父视图

例如,

item.xml

<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true"
android:layoutDirection="rtl"
>
//design
</android.support.v7.widget.CardView>

机器人:布局方向=“RTL”

输出:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.