I need my app shows a white rectangle from below by clicking a button. Is there a way to set its size and padding automatically, so it can fill perfectly on all type of devices? This is my XML code, that permits a rectangle to slide from below:
XML:
<ImageView
android:id="@+id/viewtab"
android:layout_width="359dp" <!-- I'd like it autosized with padding-->
android:layout_height="75dp" /> <!-- I'd like it autosized with padding-->
Java:
Vtab = (ImageView) findViewById(R.id.viewtab);
Vtab.setVisibility(VISIBLE);
Yes you can add one library like
add below dependency into app level gradle file ..
implementation 'com.intuit.sdp:sdp-android:1.0.4'
then after give size like below code ..
<ImageView
android:id="@+id/viewtab"
android:layout_width="@dimen/_359sdp"
android:layout_height="@dimen/_75sdp" />
then same size all device.