android - Using dp for same dimension is not working for different phones of different resolutions but same dimention -
i working on app must support sizes. since 1920x1080 wider 480x800, unable give best fit both @ same time landscape view. lie under same dimension. there no problem portrait view cause has small amount of difference on portrait view when turning landscape view entire thing not coming in screen.
this view of 1920x1080.
this view of 480x800
both these sizes accessing xml file layout-sw320dp-land
i'm facing problem hdp screens layout-sw320dp screens since has small space work with. , there no such problem higher screen sizes since have enough space decorate.
can me sort out problem?
we have many questions , answers problem i'm unable perfect solution this.
thanks in advance.
in case problem happens in screen consider using linearlayout weights, give responsive design independent screen size or resolution - instead render percentage making views take same percentage of screen no matter screen size is.
attached xml sample weighted screen.
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="90" android:orientation="horizontal" > <linearlayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="90" android:background="#8000ff00" android:orientation="vertical" > <!-- green view --> </linearlayout> <linearlayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="10" android:background="#80ff0000" android:orientation="vertical" > <!-- red view --> </linearlayout> </linearlayout> <linearlayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="10" android:background="#800000ff" > <!-- bottom blue view --> </linearlayout> </linearlayout>
Comments
Post a Comment