修改页面布局,自适应显示
This commit is contained in:
@@ -1,11 +1,16 @@
|
|||||||
package com.xscm.moduleutil.dialog.giftLottery;
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||||
@@ -19,6 +24,7 @@ import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
|||||||
import com.xscm.moduleutil.databinding.DialogGiftLotteryFragmentBinding;
|
import com.xscm.moduleutil.databinding.DialogGiftLotteryFragmentBinding;
|
||||||
import com.xscm.moduleutil.widget.pagerecyclerview.PagerGridSnapHelper;
|
import com.xscm.moduleutil.widget.pagerecyclerview.PagerGridSnapHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,6 +38,7 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
|
|||||||
private String giftBagId;
|
private String giftBagId;
|
||||||
private int type=1;
|
private int type=1;
|
||||||
private GiftLotteryAdapter adapter;
|
private GiftLotteryAdapter adapter;
|
||||||
|
private List<GiftBean> data=new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected GiftLotteryPresenter bindPresenter() {
|
protected GiftLotteryPresenter bindPresenter() {
|
||||||
@@ -45,7 +52,34 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
|
|||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
dialog.setCancelable(true);
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
Window window = getDialog().getWindow();
|
||||||
|
if (window != null) {
|
||||||
|
// 获取屏幕高度
|
||||||
|
android.util.DisplayMetrics displayMetrics = new android.util.DisplayMetrics();
|
||||||
|
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
int screenHeight = displayMetrics.heightPixels;
|
||||||
|
|
||||||
|
// 设置高度为屏幕高度的100%(全屏)
|
||||||
|
int heightInPx = screenHeight;
|
||||||
|
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||||
|
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||||
|
|
||||||
|
// 可选:设置动画样式(从底部弹出)
|
||||||
|
window.setWindowAnimations(R.style.CommonShowDialogBottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(@NonNull Context context) {
|
public void onAttach(@NonNull Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
@@ -136,7 +170,7 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
|
|||||||
setTextViewStyle(mBinding.textView2, true);
|
setTextViewStyle(mBinding.textView2, true);
|
||||||
setTextViewStyle(mBinding.textView1, false);
|
setTextViewStyle(mBinding.textView1, false);
|
||||||
}
|
}
|
||||||
|
data.clear();
|
||||||
MvpPre.getMyRecord(giftBagId, page+"", "20",type);
|
MvpPre.getMyRecord(giftBagId, page+"", "20",type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/custom_tab_layout"
|
android:id="@+id/custom_tab_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
@@ -30,21 +29,27 @@
|
|||||||
android:layout_marginEnd="@dimen/dp_16"
|
android:layout_marginEnd="@dimen/dp_16"
|
||||||
android:layout_marginBottom="@dimen/dp_30"
|
android:layout_marginBottom="@dimen/dp_30"
|
||||||
android:background="#80000000"
|
android:background="#80000000"
|
||||||
|
android:orientation="vertical"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/im_jc">
|
app:layout_constraintTop_toBottomOf="@+id/im_jc">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView1"
|
android:id="@+id/textView1"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="@dimen/dp_24"
|
android:layout_height="@dimen/dp_24"
|
||||||
android:background="@mipmap/tab_dy"
|
android:layout_marginStart="@dimen/sp_12"
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
android:layout_marginTop="@dimen/dp_16"
|
||||||
|
android:background="@mipmap/tab_dy"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="我的记录"
|
android:text="我的记录"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:layout_marginStart="@dimen/sp_12"
|
|
||||||
android:textSize="@dimen/sp_16"
|
android:textSize="@dimen/sp_16"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
@@ -64,16 +69,15 @@
|
|||||||
app:layout_constraintTop_toTopOf="@+id/textView1"
|
app:layout_constraintTop_toTopOf="@+id/textView1"
|
||||||
app:layout_constraintWidth_default="percent"
|
app:layout_constraintWidth_default="percent"
|
||||||
app:layout_constraintWidth_percent="0.2" />
|
app:layout_constraintWidth_percent="0.2" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||||
android:id="@+id/smart_refresh_layout"
|
android:id="@+id/smart_refresh_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
android:layout_marginTop="@dimen/dp_16"
|
||||||
android:layout_marginBottom="@dimen/dp_30"
|
android:layout_marginBottom="@dimen/dp_30"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView1"
|
|
||||||
app:srlEnableLoadMore="true"
|
app:srlEnableLoadMore="true"
|
||||||
app:srlEnableRefresh="true">
|
app:srlEnableRefresh="true">
|
||||||
|
|
||||||
@@ -85,20 +89,12 @@
|
|||||||
android:layout_marginEnd="@dimen/dp_10"
|
android:layout_marginEnd="@dimen/dp_10"
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/im_jc"
|
|
||||||
app:spanCount="3"
|
app:spanCount="3"
|
||||||
tools:listitem="@layout/item_prize_pool" />
|
tools:listitem="@layout/item_prize_pool" />
|
||||||
|
|
||||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||||
|
|
||||||
<View
|
</LinearLayout>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dp_60"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/smart_refresh_layout"/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user