I am trying to add an image view as a banner on top of recycler view.
(我正在尝试将图像视图添加为回收者视图顶部的横幅。)
so in some condition I can hide (View.GONE) or to show that banner image view (View.VISIBLE). (因此在某些情况下,我可以隐藏(View.GONE)或显示该横幅图像视图(View.VISIBLE)。)
but the problem is, the banner image view will never show when I run the app, even though I have set android:visibility="visible"
on the image view xml. (但是问题是,即使我在图像视图xml上设置了android:visibility="visible"
,横幅图像视图也永远不会在我运行应用程序时显示。)
as you can see, I have image view with red background, but that red background image view will not displaying
(如您所见,我的图像视图带有红色背景,但是红色背景图像视图不会显示)
how to solve this ?
(如何解决呢?)
the layout in my fragment is like this
(我片段中的布局是这样的)
and here is the xml:
(这是xml:)
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragments.Search.SearchKeywordResultFragment"
android:id="@+id/constraintLayout_search_keyword_fragment">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="0dp"
android:layout_height="0dp"
android:scrollbars="vertical"
tools:listitem="@layout/item_general_event"
android:id="@+id/recyclerView_keyword_search_result"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<ImageView
android:id="@+id/imageView_banner_search_keyword"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:background="#E91E63"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@+id/recyclerView_keyword_search_result"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:src="@tools:sample/avatars[3]" />
</androidx.constraintlayout.widget.ConstraintLayout>
ask by Alexa289 translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…