调整礼物栏高度,对文字进行部分对齐
This commit is contained in:
parent
9649a7eb01
commit
11ac669077
@ -153,7 +153,7 @@
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/giftSendBgV"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintDimensionRatio="1.56"
|
||||
app:layout_constraintDimensionRatio="1.5"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<View
|
||||
|
@ -1,13 +1,54 @@
|
||||
package com.yunbao.live.viewmodel;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
//直播时候位置做的 viewModel 注意这里
|
||||
public class LivePositionViewModel extends ViewModel {
|
||||
|
||||
//值判断到此根节点的位置
|
||||
private View RootView ;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 计算控件 Z 相对于 ViewGroupA 的位置
|
||||
* @param child 当前控件 Z
|
||||
* @param parent 目标 ViewGroupA
|
||||
* @return 相对位置 [x, y]
|
||||
*/
|
||||
public static int[] calculateRelativePosition(View child, View parent) {
|
||||
int[] position = new int[2]; // 存储相对位置 [x, y]
|
||||
|
||||
child.getLocationInWindow(position);
|
||||
child.getLocationOnScreen(position);
|
||||
//child.getLocationInSurface(position);
|
||||
|
||||
|
||||
// while (child != null && child != parent) {
|
||||
// if (child instanceof ViewGroup) {
|
||||
// ViewGroup viewGroup = (ViewGroup) child;
|
||||
// int[] childLocation = new int[2];
|
||||
// child.getLocationInParent(viewGroup);
|
||||
// position[0] += childLocation[0];
|
||||
// position[1] += childLocation[1];
|
||||
// } else {
|
||||
// int[] childLocation = new int[2];
|
||||
// child.getLocationInParent((ViewGroup) child.getParent());
|
||||
// position[0] += childLocation[0];
|
||||
// position[1] += childLocation[1];
|
||||
// }
|
||||
// child = child.getParent() instanceof View ? (View) child.getParent() : null;
|
||||
// }
|
||||
|
||||
return position;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,47 @@
|
||||
package com.yunbao.live.viewmodel;
|
||||
|
||||
public class ViewPosition {
|
||||
private int x;
|
||||
private int y;
|
||||
private int width;
|
||||
private int height;
|
||||
|
||||
public ViewPosition(int x, int y, int width, int height) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
}
|
@ -2822,12 +2822,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
newDragonGroup.setVisibility(View.VISIBLE);
|
||||
isDragonTime = isTime;
|
||||
if (isTime) {
|
||||
newDragonTv.setTextColor(ContextCompat.getColor(mContext, R.color.white));
|
||||
// newDragonTv.clearFocus();
|
||||
// newDragonTv.setTextColor(ContextCompat.getColor(mContext, R.color.white));
|
||||
newDragonTv.clearFocus();
|
||||
} else {
|
||||
newDragonTv.setTextColor(Color.parseColor("#F9BA03"));
|
||||
// newDragonTv.setTextColor(Color.parseColor("#F9BA03"));
|
||||
newDragonTv.setText(R.string.dragon_immediate_participation);
|
||||
// newDragonTv.requestFocus();
|
||||
newDragonTv.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
<View
|
||||
android:id="@+id/group_1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="3.95"
|
||||
@ -112,7 +112,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#FFFFFF"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:textSize="8sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/good_nub_ico"
|
||||
|
@ -16,16 +16,17 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:src="@mipmap/ic_live_hot_rank"
|
||||
android:layout_marginStart="7dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:layout_width="11dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.yunbao.common.views.weight.MarqueeTextView
|
||||
android:id="@+id/wish_index"
|
||||
android:layout_marginBottom="1.3dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/wish_pic"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginTop="1px"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="热度加成"
|
||||
android:ellipsize="marquee"
|
||||
|
Loading…
Reference in New Issue
Block a user