Amj*_*aig 2 android android-recyclerview android-percent-layout
我正在使用下面PercentFrameLayout的项目RecyclerView是我的布局.PercentFrameLayout没有出现.它没有出现.
我在这里缺少什么......?
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentFrameLayout 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">
<ImageView
android:id="@+id/header_image_view"
android:layout_width="match_parent"
app:layout_heightPercent="12%"
android:background="@drawable/placeholder_image"/>
</android.support.percent.PercentFrameLayout>
Run Code Online (Sandbox Code Playgroud)
当你使用时layout_heightPercent,你要求分配给它的一定百分比的空间PercentFrameLayout- 即,如果它PercentFrameLayout有一个高度100dp,layout_heightPercent="12%"则会给出带有a的子视图12dp.由于您PercentFrameLayout没有其他孩子,并且wrap_content没有明确指出12%的未指定值是什么,导致根本没有分配空间.
如果你想设置视图为整个屏幕大小或可用的总可见高度的百分比的大小RecyclerView,你将不得不做其他地方,作为理想的子类,LinearLayoutManager因为这是被控制个别元素的高度.
| 归档时间: |
|
| 查看次数: |
1197 次 |
| 最近记录: |