goweii / AnyLayer

Android稳定高效的浮层创建管理框架

Home Page:https://github.com/goweii/AnyLayer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gravity 无效

wangrui460 opened this issue · comments

mDialogLayer.gravity(Gravity.BOTTOM); 无效
版本:3.2.0
不管gravity设置什么属性都是top状态

3.0.0 之后的版本都有这个问题

感谢反馈,周末处理!

看了下demo中grivity是生效的,而且默认是居中显示。
你贴下代码和xml吧,我复制到demo测试下。

`
<com.gcssloop.widget.RCRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:round_corner_top_left="15dp"
app:round_corner_top_right="15dp"
app:clip_background="true"
android:background="@color/bg_white"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
    android:id="@+id/ll_action"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="15dp"
    android:layout_marginTop="14dp"
    android:layout_marginEnd="15dp"
    android:layout_marginBottom="14dp"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <ImageButton
            android:id="@+id/ib_close"
            android:src="@drawable/ic_comment_close"
            android:background="@color/bg_white"
            android:paddingEnd="30dp"
            android:layout_width="44dp"
            android:layout_height="match_parent" />

        <View
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <com.gcssloop.widget.RCRelativeLayout
            android:id="@+id/rcrl_publish"
            android:layout_width="74dp"
            android:layout_height="32dp"
            android:clickable="false"
            android:gravity="end"
            app:clip_background="true"
            app:round_corner="16dp">

            <TextView
                android:id="@+id/tv_publish"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/bg_gray"
                android:gravity="center"
                android:text="发送"
                android:textColor="@color/text_gray_light"
                android:textSize="@dimen/sp_14"
                android:textStyle="bold" />
        </com.gcssloop.widget.RCRelativeLayout>
    </LinearLayout>

</LinearLayout>

<com.gcssloop.widget.RCRelativeLayout
    android:layout_width="match_parent"
    android:layout_height="111dp"
    android:layout_below="@id/ll_action"
    android:layout_alignStart="@id/ll_action"
    android:layout_alignEnd="@id/ll_action"
    android:layout_marginBottom="12.5dp"
    app:clip_background="true"
    app:round_corner="2dp"
    app:stroke_color="@color/border_light"
    app:stroke_width="0.5dp">

    <EditText
        android:id="@+id/et_dialog_comment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/comment_dialog_et_bg"
        android:gravity="start|top"
        android:hint="快来写下你的评论吧~"
        android:paddingStart="8dp"
        android:paddingTop="8dp"
        android:paddingEnd="8dp"
        android:paddingBottom="8dp"
        android:textColor="@color/text_black"
        android:textColorHint="#868889"
        android:textSize="@dimen/sp_15" />
</com.gcssloop.widget.RCRelativeLayout>

<LinearLayout
    android:orientation="horizontal"
    android:layout_below="@id/et_dialog_comment"
    android:layout_width="match_parent"
    android:layout_height="35dp">
    <TextView
        android:layout_weight="1"
        android:gravity="center"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</LinearLayout>

</com.gcssloop.widget.RCRelativeLayout>`

mDialogLayer = AnyLayer.dialog(getContext()); mDialogLayer.contentView(this) .backgroundColorRes(R.color.dialog_bg) .gravity(Gravity.BOTTOM) .contentAnimator(new DialogLayer.AnimatorCreator() { @Override public Animator createInAnimator(View content) { return AnimatorHelper.createBottomInAnim(content); } @Override public Animator createOutAnimator(View content) { return AnimatorHelper.createBottomOutAnim(content); } }) .onVisibleChangeListener(new Layer.OnVisibleChangeListener() { @Override public void onShow(Layer layer) { // 先获取焦点 mEtComment.requestFocus(); DelayUtils.doSomethingInDelay(300, new DelayUtils.OnDelayListener() { @Override public void onDelay() { UIUtil.showKeyboard(getContext(), mEtComment); } }); } @Override public void onDismiss(Layer layer) { } }) .show();

mDialogLayer.contentView(this)

可以直接传布局id进去,并在xml中指定layout_grivity

我这样写在 3.0.0 上是没有问题的

嗯,今天回去看下