-4

I am creating an android application that should be supported for both phones and tablets. I found a way to create multiple layout files for each size, but I don't want to do it. Is there any way to do it through programming or some other way.

Saloni
  • 172
  • 2
  • 15
  • 1
    Which way do you try to do this? – Sergei Bubenshchikov Jan 17 '17 at 06:19
  • yes you will achive this by using proper .xml design. – Sagar Aghara Jan 17 '17 at 06:19
  • use dimen files with different size density and write suitable dimensions for your xml for different resolution. http://stackoverflow.com/questions/9877946/text-size-and-different-android-screen-sizes check this link with the accepted answer. – Ankush Bist Jan 17 '17 at 06:21
  • Thanks for your help. I am new to android and unable to do it. Sagar Aghara : Can you elaborate your answer please.? – Saloni Jan 17 '17 at 06:24
  • Ankush Bisht : I already mentioned, Is there any other way I can do it without creating individual files for different dimensions. – Saloni Jan 17 '17 at 06:27
  • @Rider..i think you have to go in Developer site for Android.you can collect more Knowledge from there...yes also check below answer. – Sagar Aghara Jan 17 '17 at 06:31

2 Answers2

0

Don't specify the width and height to certain dp values. Instead give it as match_parent or wrap_content. Also, try to include the following in manifest file.

 <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="true"
        android:xlargeScreens="true" />
Meena Dev
  • 82
  • 1
  • 9
0

Try to put height and width match parent and give weight ti every content then it will render in every screen.

prem nath
  • 75
  • 1
  • 12