I’m creating childview for viewflipper at runtime based on the no of records in database,
inflating a view and adding to viewflipper. While Clicking each childview of viewflipper, should have newviewflipper with some childs. How to achieve this?
ViewFlipper.xml
<?xml version="1.0" encoding="utf-8"?>
<ViewFlipper
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
CustomViewSample.xml
<?xml version="1.0" encoding="utf-8"?>
<com.sample.MjpegView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fullscreen_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Java Code
ViewFlipper viewflipper = (ViewFlipper)findViewById(R.id.flipper);
- **livevideocount** is an integer contains no of records from table.
for(int i=0;i<livevideocount;i++)
{
MjpegView mv = (MjpegView)inflater.inflate(R.layout.CustomViewSample,null);
mv.setVisibility(MjpegView.VISIBLE);
viewflipper.addView(mv);
}
Clicking this MjpegView object should generate another viewflipper with 3 childviews.
can anyone help me?
You should not directly inflate dynamic content into ViewFliper.
You should add dyna_layout as
<LinearLayout />or<RelativeLayout />into yourViewFlipper.xml, considerdyna_layoutas a ViewGroup: