【发布时间】:2016-09-28 11:55:49
【问题描述】:
我添加了我的代码,其中包含 Framelayout 和 mapview 动态创建和 RecyclerView 另一个布局,我在 ViewPager 片段状态适配器中使用它作为 Fragment。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/list_item"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="5dp"
android:id="@+id/rv"
android:layout_above="@+id/custom_progress1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<LinearLayout
android:id="@+id/mapLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/mapContainer"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>
【问题讨论】:
-
亲爱的朋友,您已将父布局添加为相对布局。使用线性布局而不是使用相对布局。并且还在子布局中使用权重。这样您就可以完全按照自己的意愿查看屏幕。
-
我已经改变了但仍然是相同的响应,最初刷卡工作正常,一旦选择地图视图并再次返回列表视图然后刷卡就死了,然后一旦我使用 viewpager 的页面条更改页面然后它工作正常.
-
考虑为您的问题使用更精确的标题,而不是完整的句子。
-
您是否对您的 java 代码进行了任何更改?如果是这样的话。它会正常工作。否则你可能已经做了一些改变。
-
返回列表视图时是否需要删除片段?
标签: android android-viewpager android-framelayout mapfragment