Instantiates a layout XML file into its corresponding View objects
Questions tagged [android-inflate]
651 questions
0
votes
1 answer
Is there a difference between LayoutInflater.from(context) and context.getLayoutInflater()?
My question is basically in the title but I am curious if there is a difference between context.getLayoutInflater() and LayoutInflater.from(context). For example:
View contentView = getActivity().getLayoutInflater().inflate(R.layout.some_layout,…

Sean Hill
- 1,297
- 1
- 13
- 21
0
votes
2 answers
In android what is container and the boolean value when inflating a layout?
In the code below, correct me if I am wrong but we are calling the inflator,which I am assuming is a static var? That will inflate or convert the layout we pass in to a View type? But why and what is a container, and why do we pass in a true or…

eli
- 335
- 1
- 3
- 18
0
votes
3 answers
Change ImageView drawable of an inflated layout
I want to change the drawable of imageview, that is saved to disk,, and is available. but when setting drawable, a NullPointerException occurs
The question is, how to change imageview drawable of inflated layout[Source image is…

EthenolWolf
- 3
- 5
0
votes
2 answers
NullPointerException when adding RecyclerView to Fragment
In my fragment's onCreateView method, I am inflating a layout that contains a RecyclerView. However, when I try to reference the view, I get a NullPointerException at the following line:
mRecyclerView.setLayoutManager(mStaggeredLayoutManager);
What…

nazmul
- 367
- 2
- 14
0
votes
1 answer
a function of android:how to use the function of "inflate(int resource, ViewGroup root, boolean attachToRoot)"
This image came from the official documents.But I don't understand one of the words:"or else simply an object that provides a set of LayoutParams values for root of the returned hierarchy (if attachToRoot is false.)"
Can you explain it for me?

wpumain
- 55
- 5
0
votes
1 answer
Android: Error Inflating class TextView
I am working on an Android application, I'm trying to set up a custom Header for the app and i need to change the title dynamically according to the page displayed.
I'm getting the below error and i can't figure out what the problem is
If I remove…

fadz
- 95
- 8
0
votes
1 answer
how to make a webview fragment i can inflate for multiple diff webpages
i have a web-View layout. and i want to open it using a on item click and a list view. the list view has various web pages. also the list view is in its own activity called downloads. i want to be able to inflate the view but depending on position…

P9p studios
- 69
- 1
- 8
0
votes
1 answer
Change size of only one item in GridView
public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
viewHolder.button.setText("button" + +position);
if(position == 0){
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams);
…

Kar4
- 25
- 8
0
votes
1 answer
ListView SetAdapter() Layout issue
here is the problem.
I have a listview and a bunch of array-strings. I want to fill the listview with one textview for each string. the strings are injected but after injection the layout does not repsect the one that I have defined in tip_row.xml…

Naramsim
- 8,059
- 6
- 35
- 43
0
votes
1 answer
BlurredGridMenu InflateException
This is my code for BlurredGridMenu. But error occurs everytime I try to get the blur menu. I can't find where the error is.
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import…
user5974345
0
votes
1 answer
Android: reusable layout file for different activities with multiple orientations
Is there a way to reuse a single activity layout-file (one orientation) for another activity with two orientations.
for example I have the MainActivity with one layout-file that just shows everything fullscreen:
activity_generic.xml

Wirling
- 4,810
- 3
- 48
- 78
0
votes
2 answers
Inflate a xml on linear layout in android
I try to explain my problem in points.
I have a linear layout in xml_1 which contains buttons.
I have a xml_2 which contains textview and many other views.
I want to inflate xml_2 on linear layout of xml_1.
I tried this:-
`
LayoutInflater…

saksham agarwal
- 250
- 3
- 14
0
votes
2 answers
Listview Items Repeated android
This is my Code for retrieving Data from a server, and the listview is called each time. and the items are repeated if anyone can help me with appending or something
My Code :
package NewsTabFragment;
import android.app.Activity;
import…

Subhi
- 322
- 3
- 11
0
votes
0 answers
Inflate exception in Android App - ListView
I'm a beginner and completely lost trying to fix an Inflate Exception. I have a clue that the Inflate Exception is caused by the serialization of a beans class, however, how this all works together is beyond my understanding.
The logcat looks as…

Zackline
- 804
- 1
- 9
- 28
0
votes
2 answers
why setOnClickListener not working for inflated button?
I am a beginner and I am inflating the button from tab_fragment.xml, when i am trying to setOnClickListener to that button, it is not working
LayoutInflater inflater=getLayoutInflater();
View v=inflater.inflate(R.layout.tab_fragment, (ViewGroup)…

KRISHNA TEJA
- 147
- 1
- 13