按照UI提的修改UI

This commit is contained in:
ningwenqiang
2024-11-06 16:32:06 +08:00
parent 251a428f80
commit d95206b871
12 changed files with 46 additions and 16 deletions

View File

@@ -19,6 +19,7 @@ import java.util.List;
public class NineGridLayout extends FrameLayout {
private Context mContext;
private int fullWidth1;
private int mWidth1;
private int mWidth2;
private int mWidth3;
@@ -35,6 +36,9 @@ public class NineGridLayout extends FrameLayout {
private List<?> mDataList;
private Boolean onIsFUll = false;
public void setOnIsFUll(Boolean onIsFUll) {
this.onIsFUll = onIsFUll;
}
public NineGridLayout(Context context) {
this(context, null);
@@ -58,11 +62,10 @@ public class NineGridLayout extends FrameLayout {
DisplayMetrics dm = context.getResources().getDisplayMetrics();
float scale = dm.density;
int width = dm.widthPixels - space;
fullWidth1= width;
mDividerWidth = dividerWidth;
if (onIsFUll){
}
mWidth1 = (int) (scale * 220 + 0.5f);
@@ -106,7 +109,12 @@ public class NineGridLayout extends FrameLayout {
if (dataSize == 1) {
RoundedImageView imageView = mViewList.get(0);
if (mLayoutParams00 == null) {
mLayoutParams00 = new LayoutParams(mWidth1, mWidth1);
if (onIsFUll){
mLayoutParams00 = new LayoutParams(fullWidth1, fullWidth1);
}else {
mLayoutParams00 = new LayoutParams(mWidth1, mWidth1);
}
}
if (imageView.getLayoutParams() != mLayoutParams00) {
imageView.setLayoutParams(mLayoutParams00);
@@ -114,7 +122,12 @@ public class NineGridLayout extends FrameLayout {
if (imageView.getVisibility() != VISIBLE) {
imageView.setVisibility(VISIBLE);
}
setHeight(mWidth1);
if (onIsFUll){
setHeight(fullWidth1);
}else {
setHeight(mWidth1);
}
if (mActionListener != null) {
mActionListener.displayImage(list.get(0), imageView);
}