---
title: "Responsive layout in Android"  
description: "In this article I am explain about Responsive layout in Android"  
author: "Manoj Pandey"  
published: 2015-03-05  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/1634/responsive-layout-in-android  
category: "android"  
tags: ["android", "responsive design"]  
reading_time: 3 minutes  

---

# Responsive layout in Android

[Android](https://www.mindstick.com/articles/1567/navigation-drawer-implementation-in-android) does not provide [Responsive layout](https://www.mindstick.com/forum/158661/how-to-create-a-responsive-layout-that-adapts-to-different-screen-sizes-using-css-media-queries). You have need to create different layout for supporting all the screens.\

If you would want to display same number of buttons in all screens then I would suggest you to [prepare](https://www.mindstick.com/blog/12723/dell-emc-dea-41t1-2019-march-exam-questions-how-to-prepare) different set of images/drawables and include them in [your project](https://www.mindstick.com/forum/156583/best-way-to-link-bootstrap-file-in-your-project). Here you don't need to do anything other than placing images in particular drawable folders.

Android provides [drawable folder](https://answers.mindstick.com/qa/33493/what-is-a-drawable-folder-on-android). A Drawable [resource](https://www.mindstick.com/blog/43433/top-best-resources-for-women-about-beauty-and-health) is a general [concept](https://www.mindstick.com/blog/79/routing-concept-in-dot-net) for a graphic which can be drawn. The simplest case is a graphical file (bitmap), which would be represented in Android via a BitmapDrawable class. Every Drawable is stored as individual files in one of the res/drawable folders.

**drawable-ldpi-:** By default android takes drawable images or files from this folder. It also supporting for lower density screen.

**Drawable-mdpi-:** For supporting medium density screens.

**drawable-hdpi-:** For supporting higher density screen.

**drawable-xhdpi-:** This folder [supports](https://www.mindstick.com/blog/12043/how-to-create-a-killer-mobile-app-that-supports-your-brand) for extra higher density screen.

**drawable-xxhdpi-:** This drawable folder [support](https://yourviews.mindstick.com/view/81072/pakistan-wants-enmity-not-support-from-india-during-coronavirus-pandemic) extra extra higher density screens.

##### *You can also add folder for different layout. i.e*

![Responsive layout in Android](https://www.mindstick.com/mindstickarticle/e6dedbf9-5704-466e-8a94-643afb64b550/images/432981c6-e703-4547-84c7-727b3b802347.png)

##### *Here I am creating a sample ui of calculator for different – different screens*

On default layout folder (layout/activity_main.xml)

```
<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:gravity="center"    android:orientation="vertical"    tools:context=".MainActivity" >     <EditText        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:layout_marginBottom="30sp"        android:layout_marginLeft="10sp"        android:layout_marginRight="10sp"        android:hint="Enter Value" />     <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".50"            android:text="C" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="+" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_marginRight="2dp"            android:layout_weight=".25"            android:text="-" />    </LinearLayout>     <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="1" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="2" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="3" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_marginRight="2dp"            android:layout_weight=".25"            android:text="/" />    </LinearLayout>     <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="4" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="5" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="6" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_marginRight="2dp"            android:layout_weight=".25"            android:text="*" />    </LinearLayout>     <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="7" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="8" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="9" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".25"            android:text="=" />    </LinearLayout> </LinearLayout>
```

On layout-landscappe mode (res/layout-land/activity.xml)

```
<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"    tools:context=".MainActivity" >     <EditText        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:layout_marginLeft="10sp"        android:layout_marginRight="10sp"        android:layout_marginTop="15sp"        android:hint="Enter Value" />     <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:layout_marginTop="30sp"        android:orientation="horizontal" >    </LinearLayout>     <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".16"            android:text="1" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".17"            android:text="2" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".16"            android:text="3" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_marginRight="2dp"            android:layout_weight=".17"            android:text="C" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".17"            android:text="+" />    </LinearLayout>     <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".16"            android:text="4" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".17"            android:text="5" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".16"            android:text="6" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_marginRight="2dp"            android:layout_weight=".17"            android:text="-" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".17"            android:text="*" />    </LinearLayout>     <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".16"            android:text="7" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".17"            android:text="8" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".16"            android:text="9" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_marginRight="2dp"            android:layout_weight=".17"            android:text="/" />         <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_marginLeft="3sp"            android:layout_weight=".17"            android:text="=" />    </LinearLayout> </LinearLayout>
```

You can create layout on layout-large and layout-large-land folder for large screen.

Now see calculator layout

For android device

![Responsive layout in Android](https://www.mindstick.com/mindstickarticle/e6dedbf9-5704-466e-8a94-643afb64b550/images/10546c8d-dd95-42dd-a65b-71b49141234b.png)

On device landscape

![Responsive layout in Android](https://www.mindstick.com/mindstickarticle/e6dedbf9-5704-466e-8a94-643afb64b550/images/02122130-08b1-4fb3-a958-78e6c08df1f9.png)

On android tab

![Responsive layout in Android](https://www.mindstick.com/mindstickarticle/e6dedbf9-5704-466e-8a94-643afb64b550/images/3fb9cbc7-d24c-47f1-8206-98640c08f11e.png)

---

Original Source: https://www.mindstick.com/articles/1634/responsive-layout-in-android

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
