Skip to content

Shape包下的ViewGroup控件padding处理有问题 #188

@t894924815

Description

@t894924815

当第一次调用ShapeLinearLayout内TextView的setText()方法时ShapeLinearlayout会横向或纵向动一下(取决于子view横向或纵向的长度是否是wrap_content的)
ShapeRelativelayout同样会有这个问题, 其他ViewGroup尚未测试, debug了一下猜测应该是ShadowHelper中的setShadowWidthAndContentPadding()中setPadding()未及时生效造成的, 我加在targetView?.post里就没这个问题了

img cut

测试布局:

<com.allen.library.shape.ShapeLinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="11dp"
        android:layout_marginTop="25dp"
        android:layout_marginEnd="11dp"
        android:orientation="vertical"
        app:shadowBottomWidth="6dp"
        android:paddingBottom="6dp"
        android:paddingTop="3dp"
        app:shadowColor="#0c000000"
        app:shadowCornersRadius="10dp"
        app:shadowLeftWidth="5dp"
        app:shadowRightWidth="5dp"
        app:shadowTopWidth="3dp"
        app:showShadow="true">
        <com.allen.library.SuperTextView
            android:id="@+id/supertext"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_gravity="center"
            app:sLeftIconHeight="20dp"
            app:sLeftIconMarginLeft="17dp"
            app:sLeftIconRes="@drawable/ic_user_security"
            app:sLeftIconWidth="20dp"
            app:sLeftTextColor="#1a1a1a"
            app:sLeftTextSize="15sp"
            app:sLeftTextString="左侧文本"
            app:sLeftViewMarginLeft="17dp"
            app:sRightIconMarginRight="16dp"
            app:sRightIconRes="@drawable/ic_list_item_enter"
            app:sShapeSolidColor="#FFFFFF"
            app:sUseShape="true"/>
    </com.allen.library.shape.ShapeLinearLayout>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions