1

I had developed an android app with RealtiveLayout but when I run on small screen devices the fields are overlapping.

How can I get the width and height of the device programatically so that it is easier for to adjust the screen size

Sukan
  • 346
  • 1
  • 3
  • 19

2 Answers2

0

Use Horizontall ScrollView for that then it looks perfect on small devices also.

jyomin
  • 1,957
  • 2
  • 11
  • 27
  • Horizontal Scroll view is to use "horizontal scroll". You should do this kind of operations with layouts. You should not use hsv as a layout itself. – alicanbatur Mar 07 '14 at 11:28
  • yes I also means the same Inside your layout use the horizontal scrollview – jyomin Mar 07 '14 at 11:31
0
  <compatible-screens>
    <!-- all small size screens -->
    <screen android:screenSize="small" android:screenDensity="ldpi" />
    <screen android:screenSize="large" android:screenDensity="mdpi" />
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="xhdpi" />


    <!-- support for Xperia Z, Galaxy S4 and HTC One -->
    <screen android:screenDensity="480" android:screenSize="normal" /> 
    <screen android:screenDensity="480" android:screenSize="large" /> 
    </compatible-screens> 

Try this code in the manifest I think this will work.. Other wise Create separate folders in res folder like layout-small, layout-large, layout-normal, and use appropriate images in the drawable folder drawable-hdpi, drawable-ldpi, drawable-mdpi... I am sure this will help you for various screen orientation..

Vivek Elangovan
  • 238
  • 2
  • 16