Questions tagged [android-inflate]

Instantiates a layout XML file into its corresponding View objects

651 questions
17
votes
3 answers

It inflate the view without the margin

I have this code View item = View.inflate(context, R.layout.item_layout, null); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); …
Lukap
  • 31,523
  • 64
  • 157
  • 244
17
votes
5 answers

Android + ListFragment with a custom view hierarchy

I'm attempting to customize the fragment layout by returning my own view hierarchy from onCreateView(LayoutInflater, ViewGroup, Bundle). This inflates my custom view, but seems to stack the views instead of inflating within, I see everything at…
16
votes
2 answers

How to get onClickListener() event on custom actionbar

I'm developing an application in which I have to get onClick() event on click of actionbar custom view. So far I'm able to achieve the following layout. Here is my code for achieving this: @Override protected void onCreate(Bundle…
16
votes
3 answers

How to Inflate view from XML in Android?

I'm creating a tableLayout [given in XML] adding table Row [created in XML and inflating in Java] also adding 2 textview to the table Row [created in XML and inflating in JAVA] I'm able to get only the background and textcolors but not the layout…
14
votes
4 answers

onGetLayoutInflater() cannot be executed until the Fragment is attached to the FragmentManager

I sometime get an Exception with the following message: onGetLayoutInflater() cannot be executed until the Fragment is attached to the FragmentManager My full stacktrace (which is using CompositeAndroid as the parent fragment) : Fatal Exception:…
MHogge
  • 5,408
  • 15
  • 61
  • 104
13
votes
2 answers

Can someone explain inflate method? Deeper understanding of Android views

I want deeper understanding of how Android works, and I need someone to explain how Views are actually working "under the hood". In normal procedure we would inflate (is this the correct word?) views from XML in onCreate method of our extended…
rootpanthera
  • 2,731
  • 10
  • 33
  • 65
13
votes
1 answer

Is it possible to take a screenshot of a view, without showing the view?

Short question: Suppose I have some kind of a layout file and I inflate it (or use the normal CTORs in code). Instead of showing the inflated view, I wish to take a "screenshot" (a bitmap) of how it would look like under some limitations (of given…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
11
votes
1 answer

Error inflating class

I am trying to work my way in UI. I am trying to set stateListDrawable for list entries. All I am trying to do is change the color of the list item's layout when the item is pressed, and while the list item is pressed I want to change the color of…
Mohit
  • 331
  • 1
  • 3
  • 8
10
votes
7 answers

Error inflating class com.google.android.material.slider.Slider

I want to inflate a layout containing a single seekBar. in this way, I've created a java class that extends fragment class and then I inflate the layout. but the following error occurred: Binary XML file line #9: Binary XML file line #9: Error…
mohammad rezza
  • 324
  • 1
  • 3
  • 17
10
votes
2 answers

Floating Action Button and design library inflation error

I'm using design support library defaultConfig { vectorDrawables.useSupportLibrary = true ... } dependencies { compile 'com.android.support:design:23.4.0' compile 'com.android.support:support-v4:23.4.0' ... } when I'm…
10
votes
1 answer

Android Data Binding on Individual Views Added to LinearLayout Programmatically?

I am able to get "activity-wide" data binding to work without any difficulties whatsoever. However, when I try to setup bindings for specific Views, say inflated Views that I'm programmatically adding to a LinearLayout, nothing I've tried works. For…
AutoM8R
  • 3,020
  • 3
  • 32
  • 52
8
votes
1 answer

Inflating TextView throwing noSuchMethodException on method addFontWeightStyle() during inflate process

Update: I've changed the title to remove the indication that ExoPlayer has anything to do with what is going on as I've managed to duplicate this without it being used at all. I decided to try and isolate this error on API levels: I obtained an…
8
votes
2 answers

what is the use of the layoutinflator?

I'm a new Android developer. I have tried to understand the use of Layout inflator from the documentation but have not been able to understand. what is the use of layout inflator in android? What are the situations when one would have to use it?
user590849
  • 11,655
  • 27
  • 84
  • 125
8
votes
5 answers

Error inflating class Button in Android

I have an application with min sdk 16 up to 23. I want to use Material design as much as possible. It also has to be fullscreen app. AppCompat support library is included. Now I have Logon activity with some buttons:
8
votes
7 answers

onCreateOptionsMenu not called when starting new activity

My onCreateOptionsMenu works only in my MainActivity and when I try to put another onCreateOptionsMenu in another activity to inflate a different menu it does not display my menu bar (note that I have it setup exactly the same in both activities). I…
Errol Green
  • 1,367
  • 5
  • 19
  • 32
1
2
3
43 44