I have a single ViewPager in my activity. The xml code of my activity is -
<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" />
I want to know it's Height and Width (which in this case should be the entire area covered by my application). Problem is I want to know these sizes before I send data to viewpager.
I tried to use as following -
pager= (ViewPager) findViewById(R.id.pager);
int width = pager.getWidth();
int height = pager.getHeight();
but both of them always returns 0.
Why is returning to Zero, when I have set properties to "match_parent"?
and How to get the dimensions?
Edit 1 - At present activity xml has viewpager alone, should I place it in linear/relative layout to find dimensions?
Thanks. Regards,