1

I am working with the layouts on Android, and I have created some images that adapt for different screens, so with the Android Studio, i have created it using the image asset functionality.

Now that I have all my mipmaps I want to show them up on my menu, but there is an issue, 3 of my mipmaps doesn't show up: in the Novidades, Ranking, and Histórico imageView.

Here is my xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/emerald"
    tools:context="com.example.afcosta.inesctec.pt.android.MainMenu"
    tools:layout_editor_absoluteY="25dp"
    tools:layout_editor_absoluteX="0dp">

    <RelativeLayout
        android:id="@+id/Ranking"
        app:layout_widthPercent="49.5%"
        app:layout_heightPercent="39.5%"
        app:layout_marginTopPercent="60.5%"
        app:layout_marginRightPercent="0.5%"
        android:onClick="ranking">

        <Button
            android:id="@+id/RankingBtn"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:background="@color/white"
            android:gravity="bottom|center"
            android:paddingBottom="50dp"
            android:text="Ranking" />

        <ImageView
            android:id="@+id/RankingImg"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:layout_marginTop="50dp"
            android:contentDescription="Novidades"
            android:elevation="2dp"
            android:tint="@color/white"
            android:src="@mipmap/ic_trophy" />
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/Historico"
        app:layout_widthPercent="49.5%"
        app:layout_heightPercent="39.5%"
        app:layout_marginTopPercent="60.5%"
        app:layout_marginLeftPercent="50.5%"
       >

        <Button
            android:id="@+id/historicoBtn"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentBottom="true"
            android:background="@color/white"
            android:gravity="bottom|center"
            android:paddingBottom="50dp"
            android:text="Histórico" />

        <ImageView
            android:id="@+id/bibliotecaImg"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="50dp"
            android:elevation="4dp"
            android:src="@mipmap/ic_book" />
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/Novidades"
        app:layout_widthPercent="49.5%"
        app:layout_heightPercent="39.5%"
        app:layout_marginTopPercent="20.5%"
        app:layout_marginRightPercent="0.5%"
        android:onClick="novidades">

        <Button
            android:id="@+id/novidades"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:background="@color/white"
            android:gravity="bottom|center"
            android:onClick="novidades"
            android:paddingBottom="50dp"
            android:text="Novidades" />

        <ImageView
            android:id="@+id/novidadesImg"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="50dp"
            android:tint="@color/white"
            android:elevation="4dp"
            android:src="@mipmap/ic_leaf2" />
    </RelativeLayout>


    <RelativeLayout
        android:id="@+id/biblioteca"
        app:layout_widthPercent="49.5%"
        app:layout_heightPercent="39.5%"
        app:layout_marginTopPercent="20.5%"
        app:layout_marginLeftPercent="50.5%"
        android:onClick="biblioteca">

        <Button
            android:id="@+id/historico"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:background="@color/white"
            android:gravity="bottom|center"
            android:onClick="biblioteca"
            android:paddingBottom="50dp"
            android:text="Biblioteca" />

        <ImageView
            android:id="@+id/historicoImg"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="50dp"
            android:contentDescription="Novidades"
            android:elevation="4dp"
            android:tint="@color/white"
            android:src="@mipmap/ic_library" />
    </RelativeLayout>


    <RelativeLayout
        android:id="@+id/capture"
        app:layout_widthPercent="20%"
        app:layout_heightPercent="15%"
        app:layout_marginTopPercent="50%"
        app:layout_marginLeftPercent="40%"
        android:onClick="biblioteca">



        <ImageView
            android:id="@+id/captureImg"
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:onClick="capture"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="50dp"
            android:contentDescription="Novidades"
            android:elevation="4dp"
            android:src="@mipmap/ic_camera" />
    </RelativeLayout>


    <RelativeLayout
        android:id="@+id/Questions"
        app:layout_widthPercent="49.5%"
        app:layout_heightPercent="20%"
        app:layout_marginTopPercent="0%"
        app:layout_marginRightPercent="0.5%"
        android:layout_alignParentTop="true"
        android:layout_alignParentStart="true">

        <Button
            android:id="@+id/QuestionsBtn"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/white"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:gravity="bottom|center"
            android:paddingBottom="15dp"
            android:onClick="questions"
            android:text="Questions" />

        <ImageView
            android:id="@+id/QuestionsImg"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:elevation="4dp"
            android:gravity="left|center"
            android:src="@mipmap/ic_questions" />
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/User"
        app:layout_widthPercent="49.5%"
        app:layout_heightPercent="20%"
        app:layout_marginTopPercent="0%"
        app:layout_marginLeftPercent="50.5%">

        <Button
            android:id="@+id/userBtn"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/white"
            android:gravity="bottom|center"
            android:paddingBottom="15dp"
            android:onClick="userProfile"
            android:text="Perfil"
            android:layout_alignParentTop="true"
            android:layout_alignParentStart="true" />

        <ImageView
            android:id="@+id/UserIc"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="20dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:elevation="4dp"
            android:gravity="left|center"
            android:src="@mipmap/ic_user" />
    </RelativeLayout>
Ronak Thakkar
  • 2,515
  • 6
  • 31
  • 45

1 Answers1

0

You have to use some qualifiers like -port, -land, -sw900dp, -ldpi, -mdpi, -large, -small etc. also refer to https://developer.android.com/training/multiscreen/screensizes.html and https://developer.android.com/training/multiscreen/screendensities.html I think this may help you!