0

I set a webview so:

        <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="500px"
        android:layout_below="@+id/button1"
        android:layout_centerHorizontal="true" />

but is this correct? if the resolution of the Android phone change, I should perhaps give a height in units of percent instead in pixel?

Antilope
  • 405
  • 2
  • 6
  • 16

2 Answers2

3

I suggest you use DP since it would "fit" into any dimmension. These links could help you: What is the difference between "px", "dp", "dip" and "sp" on Android? and Supporting Multiple Screen Resolutions Android Developers

Community
  • 1
  • 1
Raykud
  • 2,481
  • 3
  • 22
  • 41
0

use 500dp

dp Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".

Broak
  • 4,106
  • 4
  • 29
  • 54