Musketyr
Musketyr

Reputation: 773

Big elements on device with high screen density

I have application with elements (buttons, images, ...) in layout. All images are in resources for ldpi, mdpi, ... , xxhdpi. If I run application on tablet 7" (800x480) elements has "correct" size. But if I run application on Samsung Galaxy S3 mini 4" (screen size 480x800) the elements are too big.

How can I decrease size of elements automatically? I tried to insert these lines to manifest, but without succesfull.

<supports-screens android:xlargeScreens="true" android:smallScreens="true" android:largeScreens="true" android:normalScreens="true"
     android:resizeable="true" />

EDIT Here are images.

WRONG WRONG

GOOD GOOD

Source:

<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="right" >

    <ImageButton
        android:id="@+id/btnremove"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/close"
        android:onClick="btnRemoveSong"
        android:contentDescription="@string/remove"
        android:layout_marginRight="20dp" />

    <ImageButton
        android:id="@+id/btnUp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/move_up"
        android:onClick="moveUp"
        android:src="@drawable/up" />

    <ImageButton
        android:id="@+id/btnDown"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/down"
        android:contentDescription="@string/move_down"
        android:onClick="moveDown"
        android:layout_marginRight="20dp" />

    <TextView
        android:id="@+id/txvCurrentSong"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:singleLine="true"
        android:text="@string/play_with"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</LinearLayout>

<ListView
    android:id="@+id/listMP3"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:scrollbarAlwaysDrawVerticalTrack="true"
    android:layout_weight="1" >
</ListView>

<SeekBar
    android:id="@+id/progress"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="5dp"
    android:layout_marginBottom="5dp" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <ImageButton
        android:id="@+id/btnBack"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_backward"
        android:contentDescription="@string/backward"
        android:onClick="backward"
        android:layout_marginRight="10dp" />

    <ImageButton
        android:id="@+id/btnPlay"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_play"
        android:contentDescription="@string/play"
        android:onClick="playPause"
        android:layout_marginRight="10dp" />

    <ImageButton
        android:id="@+id/btnStop"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_stop"
        android:contentDescription="@string/stop"
        android:onClick="stop"
        android:layout_marginRight="10dp" />

    <ImageButton
        android:id="@+id/btnForward"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_forward"
        android:contentDescription="@string/forward"
        android:onClick="forward"
        android:layout_marginRight="20dp" />

    <TextView
        android:id="@+id/txvProgress"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:singleLine="true"
        android:text="@string/play_status"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</LinearLayout>

Upvotes: 1

Views: 244

Answers (1)

Musketyr
Musketyr

Reputation: 773

Ok, I make specific widths and heights for layout-sw600. Its solutions

Upvotes: 1

Related Questions