这可能是一个愚蠢的问题,但实际上我认为不是。
我正在从Firebase获取图片,我的问题是我在没有设置Number to width or Height
的情况下显示问题。例如,我无法使用这些代码行看到手机中的图像
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
或与此
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
但是,如果我将实数设置为layout_width or layout_height
,我就能看到图片。例如,
android:layout_width="wrap_content"
android:layout_height="320dp"
android:adjustViewBounds="true"
任何人都可以帮我解决它。为什么使用wrap_content或Match_parent不起作用?
编辑:我的当前布局
<android.support.v7.widget.CardView 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="match_parent"
android:layout_margin="10dp"
app:cardCornerRadius="5dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/gridViewImagee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
/>
</LinearLayout>
顺便说一句,我是CoordinateLayout,其宽度和高度为match_parent。我的RecyclerView项目位于:
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewSingleProf"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>