step1:
XML layout:
<?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>
step2:
CustomView lineView=new CustomView(activity)
RelativeLayout.addView(lineView)
This layout_content
addView
not work, but rootView_layout
addView
normal, doubt parent View NestedScrollView
affected.
but addView after not show ,why?
step3:
rootView_layout.requestLayout() // dont work
rootView_layout.invalidate() // dont work
rlayout_content.requestLayout() // dont work
rlayout_content.invalidate() //dont work