Most voted "android-layout" questions
A layout defines the visual structure of the user interface. Normally declared in XML files, they are used by Activities and Fragments to interact with the user.
Learn more…699 questions
Sort by count of
-
27
votes1
answer1896
viewsWhat’s the difference between "@id" and "@+id"?
When creating a component, we use @+id/nome to identify him. For example: <TextView android:id="@+id/tv_fornecedor" android:layout_width="match_parent" android:layout_height="match_parent"…
-
13
votes2
answers3271
viewsWhat is the difference between Listview and Recyclerview?
What difference between ListView and RecyclerView on Android? From which Api to RecyclerView is available? It is valid to use the RecyclerView and not the ListView?…
-
11
votes2
answers7686
viewsHow the android:Ems attribute works (Textview)
I would like to understand how this attribute works (android:ems). I saw something citing that he acts on the source of the text, but I did not understand how. I tried to do some tests, and did not…
-
10
votes4
answers6185
viewsWhat is the difference between match_parent and fill_parent?
When I am editing the xml layout I always get confused when choosing between the match_parent and the fill_parent, and I always end up thinking I’m doing everything wrong because I don’t know what…
-
9
votes1
answer5967
viewsWhat’s the difference between drawing in Activity and in Fragment?
After the last SDK update in Eclipse, when creating a new project, a fragment next to activity_main. I would like to know why the fragment, since before it opened directly to activity_main. Is there…
-
9
votes2
answers1017
viewsAdd new fields dynamically
I’m creating a app calculating credits from a school report. DOUBT: How to add a new EditText when the user clicks on the "+" button next to it and sums up the values of each EditText.…
-
8
votes3
answers1740
viewsHow to put caption in an Imageview
I wonder if it is possible to put caption in a ImageView similar to the image below, if possible an explanation or study material.…
-
8
votes1
answer3540
viewsChange Actionbar menu icon
I want to change the menu icon for ActionBar, those 3 points that have as default option "Settings". I’ve tried for the Style creating a custom theme and there putting the new icon but it did not…
-
8
votes2
answers749
viewsRendering error - class could not be found: android.support.v7.internal.app.Windowdecoractionbar
In my project Android Studio is giving a rendering problem in xml, giving the following error: Rendering Problems The following classes could not be found: -…
-
8
votes3
answers646
viewsImport eclipse project to latest Android Studio API
I imported the project from an eclipse app for Android Studio. The import went smoothly and Gradle was created. However, I realize that the visual components like Edittext, Progressbar, Appbar,…
-
8
votes3
answers330
viewsDoubt game two players, half screen upside down
I am creating a program to practice what I have learned so far and learn more, but I have reached a halt. The doubt is as follows: I’m creating a question and answer game for two players, each one…
-
7
votes1
answer4382
viewsSplit the app screen into two layouts
I’m looking to split the screen of the phone in half. I have two LinearLayout the same size, but it seems that the only way to do this, is to put the size on the property…
-
7
votes6
answers18836
viewsRemoving Titlebar from the android app
I’m starting on android, and know very little! I’m developing slowly and with each change I save the apk and see it running on my phone. I noticed that there is a bar in the app with the name of the…
-
7
votes2
answers151
viewsHow to remove Progressbar margins?
I added a ProgressBar simple to a LinearLayout, however I noticed that it generates a margin above and another below, such as this in the image: These two white tracks, I tried to remove anyway, the…
-
7
votes2
answers6930
viewsWhy doesn’t my image appear when running the app?
I have the following xml code in Android Studio: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" xmlns:app =…
-
6
votes3
answers16126
viewsChange text source from android APP
I’m developing an Android APP on Android Developer Tools. I would like to know how to change the text source that is standard from Android to the source Museo.otf, and how to apply to all Textviews.…
android-layoutasked 10 years, 4 months ago James 61 -
6
votes1
answer354
viewsHow to make a Floatingactionbutton square or rectangular?
I have 2 Floating Action Buttons on screen. How can I make them rectangular?
-
6
votes2
answers4150
viewsChanging Screens in Navigation Drawer
The Navigation Drawer had some changes, where the method was used onNavigationItemSelected(int position, long itemId) and now comes with the method onNavigationItemSelected(MenuItem item). I tried…
android android-layout android-fragment navigation-drawerasked 8 years, 11 months ago Mauricio Junior 149 -
6
votes1
answer933
viewsHorizontal scrollview of a Textview automatically slide when inserting dynamic texts
I have a layout simple according to the shown below that it has a ScrollView horizontal when exceeding the limit of TextView. But I would like when inserting text the focus of TextView was always at…
-
6
votes1
answer1762
viewsHow to put a logo on Toolbar?
I was researching here and I found something very interesting, the company logo on Toolbar. How do I place a company’s logo on Toolbar?
-
6
votes1
answer605
viewsWhy is it recommended to use "sp" instead of "dp" in text sizes?
Bearing in mind that when we use the unit sp in the TextView there’s always a Warning in this way: Should use "sp" Instead of "dp" for text Sizes In this Sopt response shows exactly the difference…
-
6
votes2
answers490
viewsDifference between Activity and Content
I do not know if this is the right place for this, if it is not for guidance where I take this doubt. I’m learning to develop apps in Android Studio, and I’m following some tutorials. Some cases…
-
5
votes1
answer1387
viewsDisplay a message when Listview is empty
I have a Listadapter that extends a Basedapter that works perfectly. When it is empty I wanted a message to appear any. Where to implement this validation?
-
5
votes1
answer1988
viewsMultiple layouts in one Activity - how to use?
As in this passage: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.addcontact); imageButton01 = (ImageButton)…
-
5
votes1
answer1101
viewsHow to make a Listview with components next to the text on each line?
Several current Androids systems have menus like the one in the example below: Notice that anywhere I touch my finger in the blue area under "Access my location" it turns on or off the switch and…
-
5
votes1
answer10356
viewsHow to use the Toolbar widget?
I’ve seen the own documentation of android I’ve done all the steps of other forums and still could not use Toolbar in my screen layout. How I should proceed step by step regarding the implementation…
-
5
votes6
answers922
viewsListview very long
I created a ListView that features the songs of my sdcard, but as you can see in the image below it is very long regardless of the amount of items, I want its height to be smaller to display more…
-
5
votes1
answer2999
viewsCreate button via code
It is possible to create a Button through code, rather than design mode (xml)? For example: I will create a screen with a EditText, enter a number, and click on a Button. After that, it will be…
-
5
votes2
answers928
viewsBest practices in the interaction between Activities
I’m developing an app just to validate the interaction between activities through intents. I created 5 ImageButton with an image for each one. Each button represents a movie and if the user clicks…
android android-studio android-layout code-reviewasked 9 years, 1 month ago Luiz Henrique Ugliano 651 -
5
votes1
answer281
viewsText gradient android
It is possible to create a gradient in the text (and not in the background) of a textView using only XML? I know using Shader it is possible to do with code(here) It is possible to do this using…
-
5
votes3
answers317
viewsHow to not distort the layout when opening the keyboard?
I have a linear layout with a form. Whenever the keyboard is opened it distorts my layout leaving my Buttons in half, is there any way to keep my layout intact when the keyboard is opened?? Some…
-
5
votes2
answers3434
viewsWhat’s the difference between Gravity and layout_gravity on Android?
In the customization of the layout properties in Android Studio I noticed that there is the gravity and the layout_gravity, both bear the name gravity, so I’m a little confused as to its…
-
5
votes1
answer278
viewsThemes, Styles and support android Library
Hello since I started working with Android development, I have always had a hard time understanding how the part of Themes, styles and libs of support Android, I always have a lot of difficulty for…
-
4
votes1
answer985
viewsDynamically add layouts
I created an XML with Linearlayout, in it I have a Spinner and an Edittext. On my screen I have a Linearlayout that should receive this other layout I created. My question is: how to add this custom…
-
4
votes1
answer1146
viewsHow to Make Splash Screen?
I’m developing an app for android using eclipse, in this app, when it starts, I needed to have a presentation screen (splash screen), I mean, a screen with my logo, then wait about 4 seconds, and go…
-
4
votes2
answers1170
viewsWhy does the Gravity attribute of the Linearlayout.Layoutparams object not work like the View setGravity() method?
Problem I’m working on a UI library for android, where I set the layout parameters (height, width, weight and gravity) dynamically via code, in an object LinearLayout.LayoutParams but the attribute…
-
4
votes1
answer169
viewsDifferent layout on another device
My layout looks different on small devices, already tried to add a ScrollView to solve this problem and I got no results. Follows the prints application running on different devices: Resolution 720…
-
4
votes1
answer104
viewsHow to keep the same layout for different versions?
How can I keep the layout from my apps to the different versions of Android? Example: A EditText has layout in version 2.1 and another in version 4.x, how to keep the layout version 4 in previous…
-
4
votes1
answer852
viewsHow do I layout an android app in Photoshop using PX if google only provides me DP?
I’m trying to draw the layout in photoshop, but I can’t understand this history of DP in photoshop, in code it’s okay, the compiler understands, but in photoshop I can only work in PX. Can anyone…
-
4
votes1
answer937
viewsProblem with 8 digit hexadecimal colors - Android
I am working on an app where I am trying to follow Google’s Material design guide. On this page, it is recommended to use the black color (#000000) with 87% opacity as the color of the main texts.…
-
4
votes2
answers5861
viewsChange the line color of an Edittext
I have a Layout simulating a PIN screen (type one lockscreen), where I have a EditText. I’m using the AppCompat v21 to be able to use the Material style elements. However, I want to set the…
-
4
votes2
answers243
viewsDesign in different versions of Android
I only played a few times with Android and always had problems due to test on a smartphone with Android 4.0, for example, I had to use another Ratingbar because of the incompatibility. Since…
-
4
votes1
answer1907
viewsApply Material Design (android:Theme.Material) to Android versions smaller than API 21?
I was studying a little about the Android layout guidelines as: Colors; Design material; And how to implement these guidelines; So I tried to customize my Theme, thus: <resources> <!--…
-
4
votes1
answer541
viewsType of android keyboard, text and number
There’s how I make the android keyboard stay with two types, in case I wanted numbers and letters. I tried using android:inputType, but it didn’t work. Do you already have a way to solve this? Thank…
-
4
votes3
answers1050
viewsIncreasing the size of a Textview, according to the amount of data entered in it
I am developing an app, for technical course work, and I have the following situation: I’m displaying data inside a Textview. Only there comes a time when the size is not enough. Observe the images.…
-
4
votes3
answers1444
viewsList of questions, each question with a list of answers
I’m implementing a question and answer app. For my listing I am using a Recyclerview in which I load several Cardviews (coming from loading a list). Each Cardview shows a question. Below the text of…
android android-layout android-adapter android-recyclerviewasked 8 years, 12 months ago SpammingOff 387 -
4
votes4
answers1390
viewsHow to change the dynamically displayed Layout
I want to do this, I currently have a Listview that is embedded within my activity_main.xml as follows: <include layout="@layout/lista_categoria" /> I would like to know a way to display…
-
4
votes1
answer1144
viewsHow do I change the color of the bar status icons in Material Design
I need to change icon colors equal to app of Google Agenda, as shown in the image below: I saw that in Material Design you have the options colorPrimaryDark but you don’t have to change the color of…
-
4
votes2
answers5999
viewsHow to put line break in the textview straight from xml?
wanted to put this text more organized without creating several textview , and I had the idea of using line break .…
-
4
votes1
answer907
viewsIcon Color - Android Toolbar
How do I make the icon color, in API’s smaller than 21, also white? Na 21 works ok, but below as for example the 16, turns black. I did it that way: Toolbar <android.support.v7.widget.Toolbar…