Problems multiscreen layouts android

2

I already have a few days trying the layouts of my app with all the emulators. My acitivity has a videoview and the video title below the videoview. More information below the title. With the following code

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context="com.app.videos.app.Views.reproductorActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="54dp"
    android:orientation="vertical"
    android:id="@+id/linearLayout5">
    <include
        layout="@layout/toolbar"
        android:id="@+id/toolbar_include"
        />



</LinearLayout>


<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_below="@+id/linearLayout5">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="290dp"
        android:id="@+id/frameLayout">

        <videoView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/videoView" />
    </FrameLayout>

    <FrameLayout
        android:paddingTop="1dp"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:layout_below="@+id/frameLayout"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center_horizontal|bottom">

        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:fillViewport="true"
            android:id="@+id/scrollView" >

            <LinearLayout

                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center_horizontal|top"
                android:weightSum="1"
                android:clickable="false"
                android:foregroundTint="#090909">



                <TextView

                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:text="Titulo del video"
                    android:id="@+id/textView_titulo"
                    android:autoText="true"
                    android:backgroundTint="@color/abc_background_cache_hint_selector_material_dark"
                    android:textSize="@dimen/navigation_icon_size"
                    android:textColorLink="#030303" />

                <Space
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

                <Space
                    android:layout_width="20px"
                    android:layout_height="20px" />


                <Space
                    android:layout_width="20px"
                    android:layout_height="20px" />

                <Space
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />


                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/linearLayout9">
                    <GridView
                        android:layout_width="fill_parent"
                        android:layout_height="360dp"
                        android:id="@+id/ListView_listado"
                        android:layout_gravity="center_vertical"
                        android:numColumns="2"
                        android:horizontalSpacing="10dp"/>


                </FrameLayout>





            </LinearLayout>
        </ScrollView>

    </FrameLayout>


</FrameLayout>

This I tested with all the emulators in each of the available dimensions and in some the title was more separated from the video than in other smaller emulators. The big problem is that I test it on a Lg 9 Optimus cell phone and the result is appalling. The title of the video is seen above the video and part of the grid view is also seen above the video. What do I have to do then so that my layouts look good on all the screens ??? As I explained, I have it programmed in all available dimensions

    
asked by Eduardo Jesus 08.08.2016 в 22:33
source

1 answer

0

The main problem is that in your layout you are defining the use of pixels in some widgets, which is affected when you load your application in devices of different densities , in some it will be able to show correctly the UI of your application but in others it would be displayed incorrectly, I recommend using Density-independent pixels (dp).

  

Density-independent pixels : A virtual pixel unit that is   must be used when defining the user interface design, to   express the dimensions or layout position in a way   independent of density.

    
answered by 08.08.2016 в 23:56