Добавить подвид в RelativeLayout
Шаг 1:
XML-макет:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rootView_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:overScrollMode="never">
<RelativeLayout
android:id="@+id/rlayout_content"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/left_id"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/px_36"
android:layout_toLeftOf="@+id/temp" />
<Space
android:id="@+id/temp"
android:layout_width="@dimen/px_150"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<android.support.v7.widget.RecyclerView
android:id="@+id/right_id"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/px_36"
android:layout_toRightOf="@+id/temp" />
<TextView
android:id="@+id/txtv_answer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/left_id"
android:layout_marginTop="@dimen/px_16"
android:textSize="@dimen/sp_24" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
шаг 2:
CustomView lineView = новый CustomView(действие)
RelativeLayout.addView (lineView)
это layout_content
addView
не работает, но rootView_layout
addView
нормальный, сомнительный родительский взгляд NestedScrollView
пострадавшие. но addView после не показывают, почему?
шаг 3:
rootView_layout.requestLayout () // не работает
rootView_layout.invalidate() // не работает
rlayout_content.requestLayout() // не работает
rlayout_content.invalidate() // не работает