material-components/material-components-android

[ShapeAppearanceModel] Automatically handle RTL layout

開放

#2,723 建立於 2022年5月28日

 (2 則留言) (1 個反應) (1 位負責人)Java (3,023 個分叉)batch import
Feature: ShapeGood First Issuefeature request

倉庫指標

星標
 (15,910 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Is your feature request related to a problem? Please describe. Consider the following style using MaterialCardView:

    <style name="Widget.AppTheme.CardView.Outlined.DiagonallyRounded" parent="Widget.Material3.CardView.Outlined">
        <item name="shapeAppearance">@style/ShapeAppearance.AppTheme.DiagonallyRounded</item>
    </style>

    <style name="ShapeAppearance.AppTheme.DiagonallyRounded" parent="">
        <item name="cornerSize">24dp</item>
        <item name="cornerFamily">rounded</item>
        <item name="cornerSizeBottomRight">0dp</item>
        <item name="cornerSizeTopLeft">0dp</item>
    </style>

Clearly, this will display a card rounded in the top-right and bottom-left corners (since others are set to 0). When the layout is set to RTL, it should swap the positions (it does not here since it correctly handles left or right instead of start or end).

Describe the solution you'd like It should be logical to rename the existing options or provide new options such as cornerSizeBottomEnd, cornerSizeTopStart which would handle RTL layouts.

Describe alternatives you've considered Handle it myself programmatically.

貢獻者指南