Questions tagged [layout-inflater]

The layout-inflater tag refers to the Android LayoutInflater class which is used to build a view hierarchy from an xml layout file.

The LayoutInflater class will build a view hierarchy from the XML layout, taking care of instantiating the views and setting them with the attributes values present in that layout file. This class can't be used directly, instead a reference to a valid LayoutInflater object can be obtained by using one of the methods of the Activity class or by getting it from the system services.

The usage of the LayoutInflater is simple: just use one of the inflate() methods and provide it the id of the XML layout file (in the form of R.layout.layout_file) along with other desired parameters. More information can be found in the documentation of the class.

1229 questions
-1
votes
1 answer

inflating a menu in layout is not working

i have a layout that i want to inflate with a menu. The problem is this is not inflating into it. I tried many ways basically this is the way found only. public class PostDetailActivity extends AppCompatActivity implements View.OnClickListener…
Uttam Meerwal
  • 324
  • 2
  • 12
-1
votes
2 answers

Android View inflate by using for loop

I want to delete view when clicking on a delete icon but it only removes last view whenever I click on delete icon. for (int i = 0; i < response.body().getData().getQualifications().size(); i++) { View item =…
Prabhat Rai
  • 1,532
  • 2
  • 10
  • 12
-1
votes
1 answer

Inflate ViewPagers with different ids

I want dynamically add ViewPagers to Fragment. For example I created xml:
-1
votes
1 answer

Android: Do something when checkBox is checked

I have created custom adapter and two layouts files the first layout is fragment view which contains ListView and Button the second layout contains items which will be represented in the ListView So I want when the Checkbox is check make Button…
Ali Turki
  • 1,265
  • 2
  • 16
  • 21
-1
votes
1 answer

Different ways inflate a layout

I was trying to inflate a layout and i came across these two code.Can someone please tell me the difference between these two inflate method? I am new to android studio and i want to learn more about this inflate method. Also apart from these two…
klaptor
  • 115
  • 10
-1
votes
2 answers

i want the value of inflated edittext with other layout using for loop in java

I need the value of inflated editText, I am inflating the design layout which is the child layout and MainActivity is a parent layout. below is the MainActivity class public class MainActivity extends AppCompatActivity { View array[]; String…
Kevan Aghera
  • 241
  • 3
  • 14
-1
votes
3 answers

I can not change src of imageview from inside non-activity class in Android

I'm trying to change src of ImageView from inside non-activity class and display Error dialog message at the same time, the dialog message is appeared but without any changes on the src of ImageView this is my code by using inflater, I don't know…
Samah Ahmed
  • 419
  • 8
  • 24
-1
votes
2 answers

RelativeLayout cannot be cast to TextView in LayoutInflator

I have been following this guide on making a RecyclerView, but I've run into a snag. The code it gives isn't very clear, but when building the custom Recyclerview.Adpater, it has this method: @Override public MyAdapter.ViewHolder…
-1
votes
3 answers

difference between layoutinflater.inflate and layoutinflater.from

What is the difference between layoutinflater.inflate() and layoutinflater.from()? Why does layoutinflater.from() is used in onCreateViewHolder() in RecyclerView? What is the purpose of getItemCount() in RecyclerView?
Abhishek Kumar
  • 4,532
  • 5
  • 31
  • 53
-1
votes
1 answer

Error to inflate layout

I really need help, my code was working but at some point it stopped working. I have no idea what might have happened. I REALLY NEED HELP, I will provide my java class and my layout for download, I hope someone can help me. Link to download the…
-1
votes
1 answer

Layout inflater on a custom Dialog fragment return a null pointer exception

I'm trying to show a Dialog fragment with a list of all contacts in there. I've made this adapter : package fr.nf.smsplus.adapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import…
-1
votes
1 answer

Generation of additional views while using layout inflator in android

I am using layout inflator to generator dynamic text views, edit text and buttons in android. Everything is working fine but I am getting an extra button, edit text and text view . I am populating the value of text views dynamically and it too…
Anusha
  • 939
  • 3
  • 13
  • 31
-1
votes
1 answer

ListView - Custom Adapter without LayoutInflator

Every tutorial I've tried to follow thus far has tried to get me to use a LayoutInflator inside the getView() in my CustomAdapter. The LayoutInflator does not turn up for me and I only get the options of LayoutInflatorCompat or LayoutFactory. Can…
-1
votes
1 answer

getLayoutInflater() cannot resolve in fragment

In EditWorkDetails.java (extend to fragment), it has two different layout, which are footer and footer layout . Error Error:(60, 47) error: cannot find symbol method getLayoutInflater() EditWorkDetails.java public View…
Tony
  • 2,515
  • 14
  • 38
  • 71
-1
votes
1 answer

Android inflate view multiple time depending on button state - optimisation

StackOverflow community, I need your help (again) ! I created a custom class to quickly create View object (basically it's just a question displayed). Exemple : Title : Home Message : Are you living with a cat ? [BtnYes] ------------------------ …
Nawako
  • 342
  • 3
  • 17