在ViewPager中的Fragment添加控件及TextureView
首先做一个ViewPager,这是利用一个利用FragmentPagerAdapter制作的页面。
MainActivity:
package example.com.testtextureview;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends FragmentActivity
{
private ViewPager pager;
private List<String> titleList;
private List<Fragment> fragList;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.content_main);
titleList = new ArrayList<String>();
titleList.add("第1页");
titleList.add("第2页");
titleList.add("第3页");
titleList.add("第4页");
pager = (ViewPager) findViewById(R.id.pager);
fragList = new ArrayList<Fragment>();
fragList.add(new Fragment1());
fragList