问题描述
在我的项目中,我有一个自定义视图 ExpandableTextView
,它是通过扩展以下布局 widget_expandable_textview
创建的。
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:background="@color/appDesignDarkTwo"
style="@style/widgetContainer"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvHeader"
style="@style/textLatoRegularWhite14sp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatimageView
android:id="@+id/ivDropDown"
app:srcCompat="@drawable/ic_down_arrow_blue"
android:padding="@dimen/_5sdp"
app:layout_constraintBottom_toBottomOf="@+id/tvHeader"
app:layout_constraintTop_toTopOf="@+id/tvHeader"
app:layout_constraintRight_toRightOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvContent"
style="@style/textLatoRegularWhite2_10sp"
android:layout_marginTop="@dimen/_15sdp"
android:layout_marginRight="@dimen/_11sdp"
app:layout_constraintTop_toBottomOf="@+id/tvHeader"
app:layout_constraintLeft_toLeftOf="@+id/tvHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:visibility="gone"
android:layout_marginTop="@dimen/_15sdp"
android:layout_marginRight="@dimen/_11sdp"
app:layout_constraintTop_toBottomOf="@+id/tvHeader"
app:layout_constraintLeft_toLeftOf="@+id/tvHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
在 ExpandableTextView
中,我使用
fun setBulletedList(texts: List<String>?){
mIsRecylcerViewContent = true
mView.recyclerView.visibility = View.VISIBLE
var adapter = ExpandableTextViewBulletedTextAdapter()
var layoutManager = linearlayoutmanager(context)
mView.recyclerView.layoutManager = layoutManager
texts?.let {
adapter.setList(texts)
}
mView.recyclerView.adapter = adapter
adapter.notifyDataSetChanged()
}
我在布局中添加了这个ExpandableTextView
<ExpandableTextView
android:id="@+id/ddOfferDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dimen_10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cvHeaderLayout" />
<ExpandableTextView
android:id="@+id/ddTermsAndConditions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dimen_10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ddOfferDetails" />
当我从 API 获取报价和条款和条件列表时,从我的片段中,我通过调用 ddOfferDetails.setBulletedList(LIST_OF_OFFER)
将其传递给相应的视图
ddTermsAndConditions.setBulletedList(LIST_OF_TERMS_AND_CONDITIONS)
现在的问题是,在视图中我可以看到条款和条件列表设置为 ddOfferDetails
并且没有任何列表设置为 ddTermsAndConditions
。
我观察到ddOfferDetails
首先显示优惠详情列表,几秒钟后显示条款和条件列表。
如何解决这个问题?
我希望ddOfferDetails
显示优惠详情列表,ddTermsAndConditions
显示条款和条件列表。
请帮忙
提前致谢
干杯
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)