Most voted "android-xml" questions
Android allows you to use XML, as an alternative to java, to declare various components such as: layouts, menus, features, animations, etc. Use the tag for issues specifically related to Android XML.
Learn more…51 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"…
-
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…
-
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
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…
-
4
votes2
answers123
viewsHow to apply attributes of a parent Viewgroup to child in android studio?
How to make children of a Viewgroup inherit a parent attribute? For example, I would like to set up layout_marginTop="16dp" for all Textview daughters <LinearLayout…
-
3
votes2
answers4919
viewsHow to change the color of the Statusbar?
How do I change the color of this part of the app? I wanted to put everything in the same green color as this one below.…
-
3
votes2
answers4139
viewsHow to set placeholder in Edittext?
I created a small app for Android containing only one Activity. In it I put two components Edittext. I wish to define placeholders in them, as in HTML5 inputs, but find no solution.…
-
3
votes1
answer68
viewsWhat is the difference between a Toolbar and another view?
I’m learning to use the toolbar on Android development and saw that the use of it is very similar to other views, I saw that you can put it without being at the top, that you can put items inside it…
-
3
votes1
answer7071
viewsWhy is the error "This view is not constrained ..." in Constraintlayout?
What is the reason for this mistake? This view is not constrained, it only has designtime positions, so it will jump to (0,0) unless you add constraints XML <?xml version="1.0"…
-
2
votes1
answer137
viewsParameters via xml for custom Imageview
I have a ImageView customized, which will function as a Switch. On the screen, I will have several of this item, but of different colors. I wonder if it is possible to pass a color parameter in the…
-
2
votes1
answer785
viewsChange the color of a Button that already has an assigned Background
Hello, in my application there is a table (Alert Dialog) that will be used to select the color of a component. In this table there are several equal buttons with the background already set so that…
-
2
votes2
answers155
viewsChange visibility of xml layout with the change of orientation of the device
I need to change the visibility of an xml layout when the device orientation is from Portrait (standing) to Landscape (lying down). I intend to add 2 columns when performing this action. I used the…
-
2
votes1
answer293
viewsHow to create image animation by rotating, with decreasing speed, until it stops
I have this animation below in which an Imagemview rotates on its axis for 4 seconds. It rotates even with the same speed the 4 seconds. <?xml version="1.0" encoding="utf-8"?> <set…
-
1
votes1
answer1064
viewsHow to change the color of Edittext’s bright cursor?
I’d like to know which attribute name changes that color bar,.…
-
1
votes2
answers2390
viewsUnderline a word within a Textview
As I can underline, leave in bold/italic a single word within a TextView? for example: <TextView android:text="Abelha Barco Casa Dado" android:layout_width="wrap_content"…
-
1
votes1
answer145
viewsImages in different types of screen
Right now I have these layout s to support the different screen sizes When I test the app on 4-inch or 4.5-inch devices, both will use the layout activity_main.xml which corresponds to normal size…
-
1
votes1
answer79
viewsI’m in error of Apostrophe not preceded by
I’m trying to internationalize my app to the English language but I end up getting this error Error:(10) Apostrophe not preceded by (in Please note, if you’re on a device with android 6.0 above, you…
-
1
votes1
answer821
viewsConcatenate a @string and XML text
I have a string called "key" and wanted to add the sequential numbers next to it in some textviews , but I don’t know how to concatenate into XML. For example: android:text="@string/key" + "1"…
-
1
votes1
answer138
viewsConditional return of Checkbox with problem
I’m making a mistake that ridiculously seems easy, but I can’t fix it. In my xml has a CheckBox returning false (disabled), in my java has a simple if(termosUso.isChecked()){}, in theory was so that…
-
1
votes1
answer141
viewsAutomatically scroll down an android layout after click event
Is it possible to automatically scroll down the layout after a click event? I have this layout that displays a result when the user fills the data and clicks, but I’m afraid that on devices with…
android-xmlasked 5 years, 1 month ago denis 499 -
1
votes1
answer359
viewsHow to increase the space between items in a Drawer navigation?
Developing an application saw that on devices with higher resolution the items stay very close together, desire practicality, this is how mobile apps should be, no buttons too small, this makes life…
-
1
votes1
answer370
viewsImagebutton does not display properly image background
I have a school system with schedule of each course and I have an Activity where the user must select his course to have access to his schedule. This Activity has 5 imageButtons but these…
-
1
votes1
answer185
viewsHow to create a split between views?
I’m creating an app that uses a ListView to show items and wanted to know the best and most customized way to create splitters between them, also wanted to know how to use another splitter between…
-
1
votes0
answers726
viewsChange the text color of a button via XML by clicking on it
Good afternoon ! I’m creating a styleGuides for an android application and I’m having difficulty changing the color of the button text at the moment it is clicked by the user: In this example I am…
-
1
votes0
answers46
viewsBack to Android menu
Have a menu inside a menu, like going back to the previous menu? <menu xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"…
android xml android-studio android-layout android-xmlasked 6 years, 2 months ago João G. Hartmann 31 -
1
votes1
answer212
viewsHow to Make Dynamic Tablayout in Android Studio
I created a tablayout in my application, I need that by clicking on one of the menu options, it automatically takes the 0 position. Where the house would be would be an icon to return and the others…
-
1
votes1
answer171
viewsHow to change an image dynamically when a button is pressed and save the state of that image
I have a problem where I need to alter an image of a imageView when the Button is pressed and when it is pressed again change to the image that was previously. I even managed to do this through the…
-
1
votes0
answers22
viewsError using startActivity on Fragment
I want the Button (tutorialeme) that is inside the "emergency" Ragment to have a CLICK action, and in this action I want him to call the Activity "tabbed_warning", the error is in Intent,…
android android-activity android-fragment android-xmlasked 5 years, 5 months ago Matheus Vidigal 33 -
0
votes1
answer88
viewsHow to implement this class in a Textview , so that it works correctly?
I found this code for "self-sealing" on the link https://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds and would like to know how to implement in a TextView. ** *…
-
0
votes1
answer750
viewsPut Button at the bottom of the screen - Android
I have a Expandablelistview and a button that should only appear when someone gives her the Scroll until the end. I already tried to put as footer but, if the list ends in the middle of the screen…
-
0
votes2
answers1178
viewsHow to use Scrollview and Linearlayout with full screen height?
I have my code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"…
-
0
votes0
answers43
viewsApplication closing alone after Holder.textViewVar.setVisibility
I have a RecyclerView and in each item I would like to check if a fact occurred to show or not a button: @Override public void onBindViewHolder(ViewHolder holder, int position) { Posts post =…
-
0
votes0
answers15
viewsMy design in Android Studio
the design of my app is not showing up don’t know why ? someone can help me]1…
android-xmlasked 7 years, 1 month ago cezar dos santos 1 -
0
votes1
answer271
viewsCardview inside a scrollview
I’m not getting the scrollview to work on my cardview.... Since scrollview works with a single child, I changed the main layout to Scrollview and created a linearLayout to encompass the rest within…
-
0
votes2
answers40
viewsHow to avoid layout destroyer in Tabbed Layout when changed tab?
I am making a system with tabbed layout and with Recycler view, in the first tab are the products, I click on a place the quantity and it marks the product. When I go to the third tab, the marking…
-
0
votes1
answer64
viewsWhen to use Relative or Linear Layout?
I’m wondering when to wear it LayoutRelativo or Linear? What advantage to use in each case.
-
0
votes0
answers87
viewsError String types not alowed Android Studio
I’m following a tutorial login on Facebook with Firebase, I will not put all the files because they are basically the own tutorial. When running the code, the following error appears: String types…
-
0
votes1
answer155
viewsIs it possible to import an XML file with an interest in replacing XAML?
Good morning ladies and gentlemen, It would be possible to work with XML file (layout) made in Android Studio to use in visual studio in the case of android development with Xamarin. I would like to…
-
0
votes1
answer53
viewsNavigation Activity
I would like some help when I open my Navigation Activity after login I get it like this: But I wish he was already called that with one of the pages marked like this: activity_main_drawer.xml…
-
0
votes1
answer791
viewsIt is possible to last a variable in Strings.xml
I’m trying to get a string from the.xml string to replace a field on the screen, but I’ve been searching and I’m not being able to use it as a variable xml string. <string…
-
0
votes1
answer64
viewswrap_content is not working
I’m having an error with wrap_content on android on my Imagebutton I set the image directly from a URL EXAMPLE: ImageButton img = (ImageButton) findViewById(R.id.imageButton);…
-
0
votes1
answer35
viewsProblems with xml in different screen sizes
Good afternoon, I’m not able to understand how it makes the compatibility of various screen sizes in my application, I looked on the internet and youtube and there talks to create a folder within…
-
0
votes1
answer387
viewsHow to use a Listview inside a Scrollview
Hi, I’m trying to use a Listview inside a Scrollview. The goal is to work similar to other apps that do this, such as instagram and the young nerd. Below my comment will be the code in xml and below…
-
0
votes1
answer329
viewscircle with Shape edges
How to make this circle in xml ? what I have so far: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item…
-
0
votes1
answer199
viewsI can’t adjust the image size to the layout
Hello I would like to change the layoutgravity of the image, which will always be filled on the sides and at the top. I change the layoutgravity but does not change anything. Example below: Screen…
-
0
votes1
answer26
viewsIs it possible to use a specific Strings.xml for the Android version?
I applied a different color to certain words within some Textviews with the TAG <font color='#2086F3'></font>. I was able to get this result after an Internet search. The problem is that…
-
0
votes1
answer172
viewsHow to change the course color of my Searchview
For now it is white and I need to put it in black color, I found several tutorials, but I did not find one that works, how do I do it? Code: searchViewPesquisa = (SearchView)…
-
0
votes1
answer47
viewsHow to make all content fit on the screen?
Hello! I am developing an App. However, I have difficulty in making all content fit on the screen. The code in question: <?xml version="1.0" encoding="utf-8"?> <LinearLayout…
-
-1
votes0
answers5
viewsGenerate Pdf of the page with listview android studio
I am facing difficulties to adjust an application page layout in android studio, generate image and save in pdf. I have a layout with several Textview and a Listview with scrolling, I can transform…
-
-1
votes1
answer1993
viewsHow to leave a fixed footer in the Android layout?
I have the following layout on xml on my Android designer: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"…