Search code examples
javaandroidsizescreenandroid-linearlayout

Surface elements on the screen


I have a LinearLayout in her LinearLayoutA, LinearLayoutB, LinearLayoutC and fragment. I would like to fragment occupied 3/6 of the screen, LinearA 1/6, LinearB 1/6, LinearC 1/6, So far, I set the height in dp, but this is not good idea for devices with different screen size. Is it possible ?


Solution

  • If it's a linearlayout use layout:weight for the views inside linearlayout and set their(views inside linearlayout) height to 0dp.