I have an Activity, that uses a ViewPager to page through two ListFragments -- this works great.
I am attemtpting to add some type of layout at the bottom that has an EditText, a Button, and a TextView. I want this to be fixed at the bottom of the screen, not scroll with the ListFragment.
My view looks like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/white">
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
But because I use this in my onCreate
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mViewPager = new ViewPager(this);
mViewPager.setId(R.id.pager);
setContentView(mViewPager);
}
This view isn't even being read. The problem is I'm not sure how to use a ViewPager AND specify a layout, allowing me to add such a layout at the bottom.. can anyone help me out?
Figured it out, just use the setConentView as normal, and reference the ViewPager by id.. not sure why I had a problem with this..?
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.application);
mViewPager = (ViewPager) findViewById(R.id.pager);
mTabsAdapter = new OURSVPTabsAdapter(this, mViewPager);
...
}