0

I'm using a vector asset in an image view inside the drawer navigator. But this image does'nt change size for differnt screen resolution. This is the code for drawer navigator. Im using 2 drawer navigators here in order to align the menu bottom

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_main">

        <ImageView
            android:id="@+id/logo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scaleType="fitCenter"
            android:adjustViewBounds="true"
            android:layout_gravity="center"
            app:srcCompat="@drawable/ic_logo" />

        <android.support.design.widget.NavigationView
            android:id="@+id/navigation_drawer_bottom"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:fitsSystemWindows="true"
            app:menu="@menu/activity_main_drawer">

            <TextView
                android:id="@+id/version"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:clickable="true"
                android:gravity="bottom"
                android:onClick="onClick"
                android:textColor="@color/cardview_dark_background" />

        </android.support.design.widget.NavigationView>

    </android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>

I have tried many approaches but still didn't find a solution. Please help

Amrutha Jaya Raj
  • 612
  • 2
  • 10
  • 32
  • 1
    you've give wrap content for width and height of imageview. so i will take height which are define in that drawable. that's why it will not change according to screen sizes. – Prayag Gediya Aug 26 '19 at 08:31
  • 1
    You can makes dimens folder in resource for different different screen size. define image view size in each dimens folder. and give this dimens to imageview. refer this https://stackoverflow.com/a/32861248/9792247 – Prayag Gediya Aug 26 '19 at 08:33
  • @TakeInfos That really helped! – Amrutha Jaya Raj Aug 26 '19 at 11:51

0 Answers0