Diseño de una aplicación para teléfonos y tabletas con Android

I will start with very simple basic question, How do i keep an button image for tablet and phone,

I have an button which i want to use width as full_parent, which make my button good, Now what happen if I have different - 2 layout.

I am aware of multiple layout concept, but the how can i ensure that my button image will not stretch to fit into my screen

So I thought to use dpi, but dpi will not solve problem

phone test image

if you view this image as Phone app, and button "Test this button" and about layout "test" is similiar in width,

Now what is best approach to achieve the same behavior in tablet also.

will it work for all size of devices? or do we need to go with different approach?

Most of the problem i am facing is because of static images, I tried to use different-2 dpi for this, but I think dpi is not device size dependent, because same width device can have different-2 dpi

I need to understand approach for implementing on one app for each device.

preguntado el 21 de septiembre de 13 a las 07:09

1 Respuestas

Add into the drawable folder name with xyz.xml

<?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
        <shape android:shape="rectangle">
            <gradient android:startColor="#000000" android:endColor="#333333" android:angle="90"/>
            <corners android:radius="5dp"/>

And in your layout where you crate the button add into


Obtendrás lo que quieres

Respondido el 21 de Septiembre de 13 a las 07:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.