Questions tagged [android-include]
41 questions
14
votes
2 answers
Android: with RippleEffect & StateListAnimator
I have a layout, that includes another layout:

TejjD
- 2,571
- 1
- 17
- 37
12
votes
3 answers
Databinding variable inheritance with included layout
I am learning data binding and mvvm. I have an issue where I would like a BaseViewModel.kt to include some UI related variables such as an isLoading flag and loadingText. When a network request is made, I set isLoading to true and some child of my…

Daniel Wilson
- 18,838
- 12
- 85
- 135
4
votes
0 answers
Databinding layout inside include tag
I'm trying to use data binding for dynamic layout binding. For example:
Assuming that item object defines…

tomrozb
- 25,773
- 31
- 101
- 122
4
votes
5 answers
How to change the margin of an "included" layout programatically
I have a LinearLayout inside which I am including a different layout. Something like this

user2453055
- 975
- 1
- 9
- 19
3
votes
2 answers
Edit a View (TextView / ImageView) inside a layout used in tag using custom attribute
I'm new to Android Development.
Is it possible to change a View inside an included layout using custom attribute?
I mean like this:
This is my_layout xml:

Hanif
- 95
- 1
- 6
3
votes
1 answer
Using in android.support.v7.widget.GridLayout not displaying correctly
I'm trying to use to include ImageButtons inside a android.support.v7.widget.GridLayout. The problem is, if I don't specify all the attributes explicitly on my elements, they don't display properly. In other words, the include is…

Magnus
- 17,157
- 19
- 104
- 189
2
votes
2 answers
Databind Includes Layout
Trying to dynamically set the layout using databinding but I can't seem to get the ternary operator to work right. Must be missing escape character or something.

JPM
- 9,077
- 13
- 78
- 137
2
votes
0 answers
Include same layout multiple times (containing recycler views)
I decided to make an e-commerce store app and I want to include two or more same layouts which contains a recycler view which takes it's data from java code (for now).
I tried to add different ids for both of them but I don't see the…

Lavish
- 21
- 3
2
votes
1 answer
How to add onTextChanged listener to an include layout xml by databinding in android
I have an issue to add onTextChanged to a TextInputEditText in an include layout.
There is a base_edittext_view.xml as below:

Farrokh Shahriari
- 377
- 2
- 10
2
votes
1 answer
What is the difference between fragment, extending a base class, and includes?
I am new to android and I am trying to understand how to make re-usable UI pieces that I can interact with. I know there are a few techniques out there but I don't understand when one would be better than the other or if they can all be used…

CookieMonster
- 492
- 6
- 18
1
vote
0 answers
(Android - Kotlin) - How to recover a button from included layout into fragment using view binding?
I've created a specific layout in order to display when any internet error appears in my android application.
The idea is to include this layout in the fragments where it can be a problem. This is the xml…

Tods
- 37
- 6
1
vote
0 answers
Android Accessibility: Need to press tab key twice to move to next element for the first element of the page
I am facing a problem in Android 13 where there is a scenario when a page is loaded, the user needs to access the elements by the keyboard for navigation.
When the page gets loaded it focus appears on the element but the selection does not show upon…

Android
- 37
- 6
1
vote
2 answers
Id on tag destroys layout
I have a layout in a separate xml file which gets included in other files. I want to reference the included file so I set an id. But with the id the layout gets completely unstructured.
Mini example:
Parent-Layout:

L3n95
- 1,505
- 3
- 25
- 49
1
vote
0 answers
ConstraintLayout too long xml
I have a constraintlayout with too many views (atleast 50+) in it. Now it is getting difficult to manage the xml code as it exceeds 1000 lines. I am trying to use tags to divide the code in multiple layouts as mentioned in this post but in tag it…

Nouman Bhatti
- 1,777
- 4
- 28
- 55
1
vote
1 answer
Toolbar gives fatal error on menu inflate in Intent/AppCompatActivity
In my app I have a toolbar which is working perfectly fine in my MainActivity.

creativecreatorormaybenot
- 114,516
- 58
- 291
- 402