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

Android view inflate error

I want inflate a view from a xml, just like this : View textView = LayoutInflater.from(context).inflate(R.layout.item_classify_left, null); But I got a error on the code: android.view.InflateException: Binary XML file line #2: Error inflating class…
L. Swifter
  • 3,179
  • 28
  • 52
-1
votes
2 answers

android.view.InflateException: Binary XML file line #12 in RecyclerView for JellyBean devices

I am making an app which supports from API 16 to API 22. I am using RecyclerView to display item list. My code for the layout is as follows
Apurva
  • 148
  • 1
  • 14
-1
votes
1 answer

How to set onTouch for a layout(XML) that is added via inflation?

I'm trying to get control buttons to pop on/off screen when the screen is tapped. They will overlay a video. The problem I'm running in to is how to create a touch event for a layout that has been inflated. The routine is as follows: 1) set initial…
shoota
  • 111
  • 11
-1
votes
1 answer

Should I Inflate or a new layout on top of my main layout?

I am a bit confused regarding the rendering of other layouts inside my application's main layout. I know inflate, which I use quite often, but a few days ago I came across < include /> which can be used directly in the application's main xml layout,…
Edmond Tamas
  • 3,148
  • 9
  • 44
  • 89
-1
votes
1 answer

cannot inflate layout in onCreateView of fragment

In my MenuContentActivity, I call the IntercomFragment like the following: IntercomFragment myContent= IntercomFragment.newInstance(index); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(android.R.id.content, myContent,…
Fer
  • 1,962
  • 7
  • 29
  • 58
-1
votes
1 answer

Unable to inflate a layout on button click

Hi I am trying to show a layout when a button is pressed but the layout is never shown. No exception is thrown for some reason. The button is located inside an activity. The button is called and declared and it works. The calling of the layout is…
user3182266
  • 1,270
  • 4
  • 23
  • 49
-1
votes
1 answer

How to disable user interaction with a parent layout when a child layout has been inflated in Android Programming?

I want to customize my alert dialogs in my application and not use alert dialog. What I have done was to create a layout that contains my popup warning with a dismiss button inside. When I inflate the popup warning xml layout from my activity, the…
Muhammad Aamir Ali
  • 20,419
  • 10
  • 66
  • 57
-1
votes
2 answers

Infinite while loop inside a Fragment that returns the LayoutInflater

I want to infinitely loop a method when in the Main Fragment, but I keep getting issues saying the return or the loop is unreachable or I may throw and exception. Should I be using try / catch / finally? Any ideas help! View v =…
Michael
  • 9,639
  • 3
  • 64
  • 69
-1
votes
1 answer

Avoid passing null as the view root (needed to resolve layout parameters on the inflated layout's root element)

I think that the program keeps crashing because of this public class ViewAll extends Activity { TableLayout t; MyDBManager d; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
Rabie Sh
  • 1
  • 1
-1
votes
1 answer

How to resolve a "cannot inflate" runtime error in Android?

My app is supposed to open a map. I have included play services, implemented fragments and done everything that I could! However I am getting a "cannot inflate" kind of error during run time. I am putting my manifest file, layout file and logcat…
-1
votes
3 answers

How to implement Webview into layoutinflator

I have got the source code for sliding menu and want to implement a webview into this, However it doesn't seem to work and can't find a clear answer on how to do this. Here is my code and hopefully it will make sense on what i am trying to…
user4030668
-1
votes
2 answers

android : LayoutInflater in static method

i want to call LayoutInflater from static method as below : private static void inflateLayout_keluarga_pp(int counter2, String name) { LayoutInflater inflater =…
Aoyama Nanami
  • 2,532
  • 9
  • 32
  • 50
-1
votes
1 answer

Scale tablet layout to phone

I have a (RelativeLayout) layout xml that was designed to work for 10 inch tablets. I now want the very same layout to be displayed when the app runs on a phone. Instead of it being only displayed partly, I want it to be scaled, so that the…
FD_
  • 12,947
  • 4
  • 35
  • 62
-1
votes
2 answers

Creating a transparent pass-through activity

I found this. So, far no luck. I used his code, but I'm not able to get past this error..I'm not familiar with inflaters. So could someone explain this code? final WindowManager.LayoutParams params = new WindowManager.LayoutParams( …
Karthik Balakrishnan
  • 4,353
  • 6
  • 37
  • 69
-2
votes
1 answer

What is the cause and sol to the error showing due to view Binding?

On Clicking the btnBmi button, the app is crashing, & in the logcat the error showing for binding code. I have added the code in the build.gradle file and synced it. buildFeatures { viewBinding true } // Code for .kt file. package…