解决LeftScrollView内容宽度设置问题,使用parent.getMeasuredWidth()解决。
This commit is contained in:
parent
029d4193e1
commit
489bc87959
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sat Apr 05 05:42:35 GMT 2025
|
#Sat Apr 05 06:19:16 GMT 2025
|
||||||
stageCount=0
|
stageCount=0
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=1.0
|
baseVersion=1.0
|
||||||
publishVersion=1.0.0
|
publishVersion=1.0.0
|
||||||
buildCount=446
|
buildCount=451
|
||||||
baseBetaVersion=1.0.1
|
baseBetaVersion=1.0.1
|
||||||
|
@ -5,12 +5,12 @@ package cc.winboll.studio.positions.adapters;
|
|||||||
* @Date 2025/04/04 13:38:13
|
* @Date 2025/04/04 13:38:13
|
||||||
*/
|
*/
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -217,12 +217,15 @@ public class PostionModelAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|||||||
|
|
||||||
public SimpleViewHolder(@NonNull ViewGroup parent, @NonNull View itemView) {
|
public SimpleViewHolder(@NonNull ViewGroup parent, @NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
//LinearLayout linearLayout = itemView.findViewById(R.id.linearLayout);
|
||||||
scrollView = itemView.findViewById(R.id.scrollView);
|
scrollView = itemView.findViewById(R.id.scrollView);
|
||||||
//tvRuleText = itemView.findViewById(R.id.ruletext_tv);
|
//tvRuleText = itemView.findViewById(R.id.ruletext_tv);
|
||||||
tvComments = new TextView(itemView.getContext());
|
tvComments = new TextView(itemView.getContext());
|
||||||
|
|
||||||
//tvComments.setBackgroundColor(Color.GRAY);
|
//tvComments.setBackgroundColor(Color.GRAY);
|
||||||
LogUtils.d(TAG, String.format("getWidth() %d", parent.getWidth()));
|
//LogUtils.d(TAG, String.format("linearLayout.getMeasuredWidth() %d", linearLayout.getMeasuredWidth()));
|
||||||
scrollView.setContentWidth(parent.getWidth());
|
LogUtils.d(TAG, String.format("parent.getMeasuredWidth() %d", parent.getMeasuredWidth()));
|
||||||
|
scrollView.setContentWidth(parent.getMeasuredWidth());
|
||||||
//scrollView.setContentWidth(600);
|
//scrollView.setContentWidth(600);
|
||||||
scrollView.addContentLayout(tvComments);
|
scrollView.addContentLayout(tvComments);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="2dp">
|
android:padding="2dp"
|
||||||
|
android:id="@+id/linearLayout">
|
||||||
|
|
||||||
<cc.winboll.studio.positions.views.LeftScrollView
|
<cc.winboll.studio.positions.views.LeftScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/scrollView"/>
|
android:id="@+id/scrollView"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user