I want to dynamically adjust my imagebutton size based on the screen device size of the user.
I already know about the LinearLayout and putting a weight on each image button. but then my design is kinda different
Here is my design: https://ibb.co/cudSCa
*There's an animation on this, the middle button will fade in then the other buttons will come out in the middle button *
Here is the xml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/bgf"
tools:context="com.example.kixkikx.basewalk.AdminMenu">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ImageView
android:id="@+id/imageView6"
android:layout_width="180dp"
android:layout_height="180dp"
android:layout_marginTop="180dp"
android:layout_marginLeft="70dp"
app:srcCompat="@drawable/finalogo" />
<ImageButton
android:id="@+id/button19"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginLeft="130dp"
android:layout_marginTop="450dp"
android:onClick="Timeline"
android:background="@drawable/timeline1" />
<ImageButton
android:id="@+id/button7"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginLeft="140dp"
android:layout_marginTop="20dp"
android:background="@drawable/create1"
android:onClick="CreateDF" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="135dp"
android:layout_marginTop="80dp"
android:text="Add forum"
android:textColor="#F3D42C" />
<ImageButton
android:id="@+id/button5"
android:layout_width="50dp"
android:layout_height="60dp"
android:layout_marginLeft="253dp"
android:layout_marginTop="90dp"
android:onClick="AssignTask"
android:background="@drawable/assign1" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="230dp"
android:layout_marginTop="150dp"
android:text=" Assign Task"
android:textColor="#F3D42C" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST"
android:textSize="16sp"
android:textColor="#984491"
android:visibility="invisible"
android:id="@+id/textView4"
android:layout_marginBottom="30dp"
android:layout_marginRight="50dp"
android:layout_marginTop="150dp"
android:layout_marginLeft="50dp" />
<ImageButton
android:id="@+id/button8"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="90dp"
android:background="@drawable/forum1"
android:onClick="ViewManager"
android:text="Log History" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="150dp"
android:text="View Forum"
android:textColor="#F3D42C"
/>
<TextView
android:id="@+id/textView99"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="120dp"
android:layout_marginTop="495dp"
android:text="View timeline"
android:textColor="#F3D42C" />
<ImageButton
android:id="@+id/button6"
android:layout_width="60dp"
android:layout_height="60dp"
android:onClick="ViewTask"
android:layout_marginLeft="30dp"
android:layout_marginTop="350dp"
android:background="@drawable/report1"
/>
<TextView
android:id="@+id/textView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="410dp"
android:layout_marginLeft="13dp"
android:textColor="#F3D42C"
android:text="View Task Reports" />
<ImageButton
android:id="@+id/button10"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="350dp"
android:layout_marginLeft="230dp"
android:background="@drawable/logout1" />
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="410dp"
android:layout_marginLeft="240dp"
android:textColor="#F3D42C"
android:text="Log out" />
</RelativeLayout>
</RelativeLayout>
My problem is: I don't know how to make those imagebutton to become a dynamic where it will adjust it's size based on the screensize of the device/phone while maintaining the design that i created. All images in the imagebutton has hdpi/xhdpi/xxhdpi. i generated those icon using image asset.
I also want to include the textView to be alligned for each of the imagebuttons.