update 调整女神说布局大小

This commit is contained in:
zlzw 2023-04-01 11:14:24 +08:00
parent ef757a8adc
commit 97ad5c2d92
6 changed files with 28 additions and 25 deletions

View File

@ -76,7 +76,7 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter<LiveAnchorSa
} }
public void setData(String text, int position) { public void setData(String text, int position) {
textView.setText("已输入的\n内容已输\n入的内容\n入的内容"); textView.setText("已输入的内容\n已输入的内容\n已输入的");
ImgLoader.display(mContext, text, icon); ImgLoader.display(mContext, text, icon);
if (position == click) { if (position == click) {
itemView.setBackgroundResource(R.drawable.bg_anchor_say_select); itemView.setBackgroundResource(R.drawable.bg_anchor_say_select);

View File

@ -121,20 +121,7 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
sayModel.getLivePreview().setContent(s.toString()); sayModel.getLivePreview().setContent(s.toString());
StringBuilder sb = new StringBuilder(); sayText.setText(getText(s.toString()));
int len=6;
int n = (s.length() + 3) / len;
for (int i = 0; i < n; i++) {
if (i < (n - 1)) {
sb.append(s.toString().substring(i * len, (i + 1) * len)).append("\n");
} else {
sb.append(s.toString().substring(i * len));
}
}
if (sb.length() == 0) {
sb.append("默认字符\n默认字符\n默认字符");
}
sayText.setText(sb.toString());
} }
@Override @Override
@ -142,6 +129,21 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow {
} }
public String getText(String content) {
int t = 6;
float len = (float) content.length() / t;
StringBuilder sb = new StringBuilder();
sb.append("\n");
for (int i = 0; i < len; i++) {
if (len - i < 1) {
sb.append(content.substring(i * t));
} else {
sb.append(content.substring(i * t, i * t + t)).append("\n");
}
}
return sb.toString();
}
}); });
close.setOnClickListener(v -> { close.setOnClickListener(v -> {
dismiss(); dismiss();

View File

@ -9,7 +9,7 @@
android:id="@+id/anchor_say" android:id="@+id/anchor_say"
layout="@layout/sim_live_room_anchor_say" layout="@layout/sim_live_room_anchor_say"
android:layout_width="77dp" android:layout_width="77dp"
android:layout_height="88dp" android:layout_height="110dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:visibility="invisible" android:visibility="invisible"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="106dp" android:layout_width="106dp"
android:layout_height="128dp" android:layout_height="128dp"
android:layout_marginStart="5dp" android:layout_marginStart="2dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:background="@drawable/bg_anchor_say" android:background="@drawable/bg_anchor_say"
android:layout_marginTop="10dp"> android:layout_marginTop="10dp">
@ -11,8 +11,8 @@
<include <include
layout="@layout/sim_live_room_anchor_say" layout="@layout/sim_live_room_anchor_say"
android:layout_width="67dp" android:layout_width="83dp"
android:layout_height="88dp" android:layout_height="110dp"
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"

View File

@ -2,20 +2,21 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="67dp" android:layout_width="77dp"
android:layout_height="88dp"> android:layout_height="110dp">
<ImageView <ImageView
android:id="@+id/anchor_say_icon" android:id="@+id/anchor_say_icon"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:scaleType="fitXY"
android:src="@color/main_color_79CDF9" android:src="@color/main_color_79CDF9"
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_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@color/main_color_79CDF9" /> tools:srcCompat="@mipmap/tmp" />
<TextView <TextView
android:id="@+id/anchor_say_text" android:id="@+id/anchor_say_text"
@ -28,14 +29,14 @@
android:gravity="center" android:gravity="center"
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:maxEms="6" android:maxEms="6"
android:text="中文测试\n中文测试\n中文测试\n中文测试" android:text="已输入的内容\n已输入的内容\n已输入的"
android:textColor="#333333" android:textColor="#333333"
android:textSize="10sp" android:textSize="10sp"
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_toTopOf="@+id/anchor_say_icon" app:layout_constraintTop_toTopOf="@+id/anchor_say_icon"
tools:text="中文测试\n中文测试\n中文测试\n中文测试" /> tools:text="已输入的内容\n已输入的内容\n已输入的" />
<ImageView <ImageView
android:id="@+id/anchor_say_hide" android:id="@+id/anchor_say_hide"

View File

@ -1295,7 +1295,7 @@
android:id="@+id/anchor_say_layout" android:id="@+id/anchor_say_layout"
layout="@layout/sim_live_room_anchor_say" layout="@layout/sim_live_room_anchor_say"
android:layout_width="77dp" android:layout_width="77dp"
android:layout_height="88dp" android:layout_height="110dp"
android:layout_alignBottom="@+id/live_video" android:layout_alignBottom="@+id/live_video"
android:layout_marginStart="14dp" android:layout_marginStart="14dp"
android:visibility="invisible" android:visibility="invisible"