# android layout

Published articles for android layout.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Controlling TextView MinWidth

DevFeed: [Controlling TextView MinWidth](<https://devfeed.tech/articles/controlling-textview-minwidth-38652.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2021_09_14_controlling_textview_minwidth/>)

Published: 2021-09-14T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [constraintlayout](<https://devfeed.tech/topics/constraintlayout.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-layout](<https://devfeed.tech/tags/android-layout.md>), [background](<https://devfeed.tech/tags/background.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [gravity](<https://devfeed.tech/tags/gravity.md>), [layout](<https://devfeed.tech/tags/layout.md>), [properties](<https://devfeed.tech/tags/properties.md>), [textview](<https://devfeed.tech/tags/textview.md>), [xml](<https://devfeed.tech/tags/xml.md>)

### AI overview

A technical explanation of how Android TextView minimum-width APIs interact. Setting minWidth or minimumWidth alone may not reset a dimension declared in XML; both properties must be cleared, and a background can still impose a minimum width.

### Source excerpt

Introduction Sometimes we might need our TextView with wrap_content width to occupy more space than it will based on amount of characters it displays. For that we can set minimum width. Usually, we do that via XML like this: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout 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" tools:context=".MainActivity"> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/bg_text" android:gravity="center" android:minWidth="200dp" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> Having setup like this we ensure that our TextView will occupy a minimum of 200dp. Also, we can control minimum width programmatically via: TextView#setMinWidth. But controlling minimum width programmatically has one caveat that I'd like to describe below.

## Sharing Android sample data between projects with Gradle

DevFeed: [Sharing Android sample data between projects with Gradle](<https://devfeed.tech/articles/tools-title-remotesampledata-39029.md>)

Original publisher: [Read original article](<https://vladimirj.dev/remote-sample-data/>)

Author: Vladimir Jovanović

Published: 2018-03-10T09:44:00Z

Content type: tutorial

Language: en

Sources: [Vladimir Jovanović](<https://devfeed.tech/sources/vladimir-jovanovic.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Script](<https://devfeed.tech/topics/script.md>), [layout](<https://devfeed.tech/topics/layout.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [android-layout](<https://devfeed.tech/tags/android-layout.md>), [code](<https://devfeed.tech/tags/code.md>), [design](<https://devfeed.tech/tags/design.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [layout](<https://devfeed.tech/tags/layout.md>)

### AI overview

This tutorial explains how to share custom Android sample data across projects by hosting the files and using Gradle scripts to download them into a project folder.

### Source excerpt

Doing copy/paste of the sample data from one project to another is not an option.

## Improving Android Layout Previews with Sample Resources and Preview Attributes

DevFeed: [Improving Android Layout Previews with Sample Resources and Preview Attributes](<https://devfeed.tech/articles/tools-title-layoutpreview-39027.md>)

Original publisher: [Read original article](<https://vladimirj.dev/layout-preview/>)

Author: Vladimir Jovanović

Published: 2018-02-18T09:44:00Z

Content type: tutorial

Language: en

Sources: [Vladimir Jovanović](<https://devfeed.tech/sources/vladimir-jovanovic.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [layout](<https://devfeed.tech/topics/layout.md>), [ui](<https://devfeed.tech/topics/ui.md>), [XML](<https://devfeed.tech/topics/xml.md>), [coding](<https://devfeed.tech/topics/coding.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [android-layout](<https://devfeed.tech/tags/android-layout.md>), [coding](<https://devfeed.tech/tags/coding.md>), [design](<https://devfeed.tech/tags/design.md>), [layout](<https://devfeed.tech/tags/layout.md>), [ui](<https://devfeed.tech/tags/ui.md>), [xml](<https://devfeed.tech/tags/xml.md>)

### AI overview

This tutorial explains how Android developers can improve XML layout previews using sample resources and preview attributes. It covers showing representative text and images, previewing repeated items, configuring horizontal orientation, and displaying menu items without adding runtime view state.

### Source excerpt

As every Android developer, I also started building my layouts by hard-coding values into them. Later on, I have realised that I should...