I maked with constrait layout and picture png.
`
<ImageView
android:layout_width="300dp"
android:layout_height="200dp"
android:src="#drawable/wuislogo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.498" />
`
Related
I am facing problem with the scaling of "images", "text fields", "buttons", basically all the elements I have used in my layout.
If you see below, This is is a 5.5 inch resolution display and my application is looking perfect, but when I change screen resolution, my elements start overlapping. This is how it starts looking...
Elements starts overlapping eachother, can anyone help me with this issue? I have been struggling for 4 days now.
Below is the layout XML...
ALSO I WAS DRAGGING THE SMALL CENTERED BUBBLES TO MATCH IT TO THE SCREEN SEND SO THAT I COULD BUILD, OTHERWISE I WAS GETTING BUILD ERROR, SO I DRAGGED THOSE BUBBLES TO EDGE OF THE SCREEN TO MAKE IT FIX
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".MainActivity"
android:background="#drawable/appbackgroundall">
<Switch
android:id="#+id/smartlever"
android:layout_width="116dp"
android:layout_height="42dp"
android:checked="false"
android:hapticFeedbackEnabled="true"
android:scaleX="2"
android:scaleY="2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.294"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.499"/>
<TextView
android:id="#+id/smartButtonText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/sansationregular"
android:scaleX="2"
android:scaleY="2"
android:text="Tap to alter smart mode"
android:textColor="#color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.433" />
<ImageView
android:id="#+id/allbackcologo"
android:layout_width="66dp"
android:layout_height="62dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.976"
app:srcCompat="#drawable/companylogo" />
<ImageView
android:id="#+id/spaceman"
android:layout_width="205dp"
android:layout_height="253dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.868"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.15"
app:srcCompat="#drawable/spaceman" />
<ImageView
android:id="#+id/pingedlogo"
android:layout_width="139dp"
android:layout_height="52dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.058"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.023"
app:srcCompat="#drawable/pingedlogo" />
<Button
android:id="#+id/developerbutton"
style="#style/Widget.MaterialComponents.Button.TextButton"
android:hapticFeedbackEnabled="true"
android:layout_width="64dp"
android:layout_height="61dp"
android:fontFamily="monospace"
android:scaleX="2"
android:scaleY="2"
android:text=""
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.976" />
<ImageView
android:id="#+id/settingButton"
android:layout_width="61dp"
android:layout_height="59dp"
android:rotation="175"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.923"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.023"
app:srcCompat="#drawable/settingbutton" />
<Button
android:id="#+id/settingB"
style="#style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="60dp"
android:layout_height="59dp"
android:fontFamily="monospace"
android:scaleX="2"
android:scaleY="2"
app:layout_constraintBottom_toBottomOf="#+id/settingButton"
app:layout_constraintEnd_toEndOf="#+id/settingButton"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="#+id/settingButton"
app:layout_constraintTop_toTopOf="#+id/settingButton"
app:layout_constraintVertical_bias="0.0" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.093"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.784"
app:srcCompat="#drawable/alientwo" />
</androidx.constraintlayout.widget.ConstraintLayout>
Try to use minWidth and maxWidth,
example :
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.093"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.784"
app:srcCompat="#drawable/alientwo" />
I have an inner constraint layout that is hosting an icon, text and button to open another activity.
This is the XML
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/manageMyAccount"
android:layout_width="0dp"
android:layout_height="40dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:contentDescription="TODO"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_search_black_24dp" />
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="#string/settings_manage_my_account"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/imageButton"
app:layout_constraintStart_toEndOf="#+id/imageView4"
app:layout_constraintTop_toTopOf="parent"
tools:text="Manage My Account" />
<ImageButton
android:id="#+id/imageButton"
android:layout_width="43dp"
android:layout_height="34dp"
android:background="#android:color/transparent"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:srcCompat="#drawable/arrowforward" />
</androidx.constraintlayout.widget.ConstraintLayout>
I need about 40 instances like this with different text and Icons, other than make it a list(which I can't as I have 2 types of those layouts. how can I effectively copy and pate this without creating name conflict? and the other mess that comes with it.
I'm trying to align two views one behind the other, centered vertically and horizontally.
The size of the views are set dynamically to the size of the screen, this is the XML of the screen:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context=".MainActivity">
<ImageView
android:id="#+id/yellow"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#faff68"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.6"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toBottomOf="#id/purple"
app:layout_constraintLeft_toLeftOf="#id/purple"
app:layout_constraintRight_toRightOf="#id/purple"
app:layout_constraintTop_toTopOf="#id/purple" />
<ImageView
android:id="#+id/purple"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#c303fa"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.5"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
The result is not as expected
How can the yellow image be centered behind the purple image using Constraint Layout? (I know how to achieve it in other layouts)
Update -
You can use Circular Positioning to center your larger view behind your smaller view.
<ImageView
android:id="#+id/yellow"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#faff68"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.5"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toBottomOf="#id/purple"
app:layout_constraintLeft_toLeftOf="#id/purple"
app:layout_constraintRight_toRightOf="#id/purple"
app:layout_constraintTop_toTopOf="#id/purple"
app:layout_constraintCircle="#id/purple"
app:layout_constraintCircleRadius="0dp"/>
<ImageView
android:id="#+id/purple"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#c303fa"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.4"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Instead of trying to center the larger view behind the smaller view, you could fix your larger view and center your smaller view in front of it.
Something along the following lines should work,
<ImageView
android:id="#+id/yellow"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#faff68"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.5"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="#+id/purple"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#c303fa"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.4"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toBottomOf="#id/yellow"
app:layout_constraintLeft_toLeftOf="#id/yellow"
app:layout_constraintRight_toRightOf="#id/yellow"
app:layout_constraintTop_toTopOf="#id/yellow" />
Try this way
<ImageView
android:id="#+id/yellow"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#faff68"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.6"
app:layout_constraintBottom_toBottomOf="#id/purple"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#id/purple" />
<ImageView
android:id="#+id/purple"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#c303fa"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.5"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
If you want the yellow to be the same size as the other image just change this line in your yellow image
app:layout_constraintHeight_percent="0.6"
To this:
app:layout_constraintHeight_percent="0.5"
All you need to do is to make the value of app:layout_constraintHeight_percent the same on both images.
In your case, one image was with the size of 50% screen size and the other was with 60% so they didn't looked the same size
replace your yellow image with this
<ImageView
android:id="#+id/yellow"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#faff68"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.6"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
I'm developing an android app to support all screen sizes, but when it come to long screens like 18:9 it giving me weird results in screen. I have following layout folders "layout,layout-large,layout-xlarge,layout-normal" and 18:9 screen ratio devices are using default settings of "layout" folder does android can have different kind of folder to place this type of layouts xml files only work with 18:9 screens. Or any other method to handle long screens.
My Layout folders are
layout,
layout-large,
layout-normal,
layout-xlarge,
In this image it shows how it overflow my text in 18:9 screen.
My activity_main.xml is here
`
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:id="#+id/Main_layout"
>
<android.support.constraint.ConstraintLayout
android:layout_width="0dp"
android:layout_height="80dp"
android:background="#drawable/layout_bg"
android:layout_marginTop="2dp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:id="#+id/Head_layout">
<ImageButton
android:id="#+id/Image_btn_home"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:background="#drawable/home"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="32dp" />
<TextView
android:id="#+id/text_view_head_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="47dp"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
android:text="Hello Animals"
android:textColor="#000000"
android:textSize="45sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="#+id/Image_btn_home"
app:layout_constraintRight_toLeftOf="#id/Image_btn_info"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<ImageButton
android:id="#+id/Image_btn_info"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginBottom="8dp"
android:layout_marginRight="32dp"
android:layout_marginTop="8dp"
android:background="#drawable/info"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:id="#+id/view_pager_container_layout"
android:layout_width="0dp"
android:layout_height="365dp"
android:background="#drawable/layout_bg"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Head_layout">
<android.support.v4.view.ViewPager
android:id="#+id/View_pager"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="1dp"
android:layout_marginLeft="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0">
</android.support.v4.view.ViewPager>
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:id="#+id/constraintLayout"
android:background="#drawable/layout_bg"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#+id/Navigation_layout"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/view_pager_container_layout"
app:layout_constraintVertical_bias="0.0">
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="8dp"
ads:adSize="SMART_BANNER"
ads:adUnitId="#string/banner_ad_unit_id"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:background="#drawable/layout_bg"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_marginTop="380dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintVertical_bias="1.0"
android:id="#+id/Navigation_layout"
app:layout_constraintTop_toTopOf="#+id/Head_layout">
<ImageButton
android:id="#+id/Image_btn_left"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:background="#drawable/left"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="32dp" />
<ImageButton
android:id="#+id/Image_btn_right"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="300dp"
android:layout_marginTop="8dp"
android:background="#drawable/right"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="1.0"
android:layout_marginStart="300dp" />
<ImageButton
android:id="#+id/Image_btn_play"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="8dp"
android:background="#drawable/play"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintLeft_toRightOf="#+id/Image_btn_left"
app:layout_constraintRight_toLeftOf="#+id/Image_btn_right"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
`
Have u tried using constraint layout? The best way to create a responsive layout for different screen sizes is to use ConstraintLayout as the base layout in your UI. ConstraintLayout allows you to specify the position and size for each view according to spatial relationships with other views in the layout. This way, all the views can move and stretch together as the screen size changes.
This is the first screenshot, where everything is working fine with a placeholder background.
This is the second screenshot, where the two ImageButtons don't display anymore.
For reference, here's my test xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context="com.bruisedbanana.squareshift.MainActivity">
<ImageView
android:scaleType="centerCrop"
android:src="#drawable/squareshiftbackground"
android:id="#+id/imageView2"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="8dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
/>
<ImageButton
android:id="#+id/buttonPlay"
android:background="#drawable/buttonPlay"
android:layout_width="95dp"
android:layout_height="45dp"
android:layout_marginRight="8dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintHorizontal_bias="0.502"
android:layout_marginBottom="8dp"
app:layout_constraintVertical_bias="0.952"
app:layout_constraintBottom_toTopOf="#+id/buttonExit" />
<ImageButton
android:id="#+id/buttonExit"
android:background="#drawable/buttonExit"
android:layout_width="95dp"
android:layout_height="45dp"
android:layout_marginRight="8dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="#+id/imageView2"
android:layout_marginTop="8dp"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
app:layout_constraintVertical_bias="0.891" />
</android.support.constraint.ConstraintLayout>
All I'm doing is changing the src from #drawable/squareshiftbackground to #drawable/realbackground. Can anyone help?
You can try YourImageButton.bringToFront() to the image butons after changing the ImageView source.