This is working fine on emulator but not on the devices because I have hard coded the height to 365. Can anyone help me in this regard?
You can change the layout height dynamically through different ways-----
First,
getLayoutParams().height= x;
requestLayout(); or invalidate();
Secondly,
first_tab.setHeight(int pixels);
Try using anyone of the way.......
You should not use px
, use dp
instead.
android:layout_height="365dp"
Have a read here, to know Density independent pixel(dp) better.
Using dp units to define your application's UI is highly recommended, as a way of ensuring proper display of your UI on different screens.