2

I have an ImageView (human body) and buttons over this image. enter image description here

Is it possible somehow easily create this in RelativeLayout for the most different screen sizes? Or should I create different layouts for different screen sizes?

How would you proceed? What do you recommend?

Onik
  • 19,396
  • 14
  • 68
  • 91
Pepa Zapletal
  • 2,879
  • 3
  • 39
  • 69
  • If your image is going to be the full screen, I would just say make it the background of your Relative View and then just add the buttons normally – Fred L Sep 22 '15 at 13:34

3 Answers3

3

Have a look at the percent library.

It would be perfect for something like this, and would work for every device. You'd have to work out the percentage width, height, and margin for each PercentRelativeLayout relative to your person image.

Here's an example:

<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <View
        app:layout_widthPercent="25%"
        android:layout_height="100dp"
        app:layout_marginLeftPercent="5%"
        android:background="#ff0000" />

</android.support.percent.PercentRelativeLayout>

and remember to

compile 'com.android.support:percent:23.0.0'
MSpeed
  • 8,153
  • 7
  • 49
  • 61
1

This is an example for an imageview with clickeable areas.

https://blahti.wordpress.com/2012/06/26/images-with-clickable-areas/

I hope it will helps to you.

Víctor Martín
  • 3,352
  • 7
  • 48
  • 94
  • Do you have tip how to show buttons (or images) where user can click (in clickable areas) ? Or when user click on clickable area change the color of image there? If user select some area, it should has a different color (image). Like the image in the original question. – Pepa Zapletal Sep 22 '15 at 14:41
  • Use, custom buttons or custom toggle buttons. Search on stackoverflow board, there is a lot of entries talking about that. You can use the library ION to load a gif in the imageview, there are a lot of options. Choose one and try it, If you cann't continue, come back with errors :). – Víctor Martín Sep 23 '15 at 14:57
0

Yes it is possible with Relative layout but its difficult.

for this you have to focus on

  1. different images with perfect cutting.
  2. put images in all drawable.
  3. Create Relative layout and starting with image-view at one side to end side as reference wise.
  4. Margin add in different dimen.xml
SuN
  • 1,723
  • 1
  • 13
  • 14