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
0
votes
2 answers

Layout not inflating correclty

When I run my application, I get this error: 01-06 15:00:42.865: E/AndroidRuntime(24230): FATAL EXCEPTION: main 01-06 15:00:42.865: E/AndroidRuntime(24230): java.lang.RuntimeException: Unable to start activity…
user1513687
  • 173
  • 2
  • 13
0
votes
1 answer

How to programatically change an attribute of widget created by a LayoutInflater?

I want to access the child of a widget created by a LayoutInflater in order to change the text displayed by a TextView inside it. How could I do this? I've made a diagram to explain. LinearLayout --->LayoutInflater ---->LinearLayout …
Tim
  • 834
  • 2
  • 12
  • 31
0
votes
2 answers

Android Custom Views vs inflating xml

I have a simple question: Could you give me some tips about using Custom views vs Layout inflater into executing code? Which one is more preferred to use? Can some one explain me the Pros and Cons of both. If my question is not clear, the below is…
0
votes
0 answers

Adding an unknown number of imageviev(each of them has absolute position on X and Y) to the page

There is a task to place on the page of viewPager required number of images with absolute position. Number and positions are obtained from another app, so are unknown. How to implement it? Got any ideas?
Factory Girl
  • 910
  • 4
  • 18
  • 29
0
votes
0 answers

ActionBarSherlock Fragments display/access

I got an Dynamic Layout with a SherlockActionbar. In Landscape Mode I got two Fragments that should be displayed side by side. But the Second Fragment isn't displayed. MainActivity onCreate @Override public void onCreate(Bundle…
Ceryni
  • 371
  • 1
  • 5
  • 18
0
votes
1 answer

Inflate Button exactly at centre of the touch point on DragEvent.ACTION_DROP on AbsoluteLayout

I want the button to be inflated with its centre point = touch point. At the time of inflating, m doing as follows: control = inflater.inflate(R.layout.button, (ViewGroup) target_layout,…
0
votes
1 answer

Inflating a checkbox layout in an AlertDialog works, textview layout doesn't

I have this piece of code to display an alert dialog when an item in a listView is clicked; all worked ok until I added a checkbox preference that should enable another dialog to enter a text string (to be used later on). AlertDialog.Builder…
dentex
  • 3,223
  • 4
  • 28
  • 47
0
votes
3 answers

Every View stick together when loop LayoutInflater

I have a layout problem. my code have a LayoutInflater set the following xml as layout, and will loop few time to show my school time table. Eventhough i have set the relativelayout's marginBottom and Top to 50dp, but why every layout still stick…
crossRT
  • 616
  • 4
  • 12
  • 26
0
votes
2 answers

Save state of a container (LinearLayout)

I have two fragments. In first fragment I have a container static (LinearLayout) that to the view of fragment. In this container i do a inflation of several views. I change to a second fragment, but when i return to the first fragment the views…
0
votes
1 answer

What is equivalent to findViewById using LayoutInflater in Android?

I don't fully understand LayoutInflater functions though I used it in my projects. For me it's just a way to find view when I cannot call findViewById method. But sometimes it does not work like I expect. I have this really simple layout…
Vitalii Korsakov
  • 45,737
  • 20
  • 72
  • 90
0
votes
1 answer

How do I create a fragment view without the layout inflater?

I am working on Fragments in Android and would like to programmatically inflate my view - without the LayoutInflater. In my class, which extends Fragment, I would like to do something basic, like this: @Override public View onCreateView…
Phil
  • 35,852
  • 23
  • 123
  • 164
0
votes
1 answer

Inflating Views and Objects Android

I have a PagerAdapter with two views. Right now I am calling populateList() from the xml by attaching a android:onClick="populateList()" to a button. If I try to call the populateList() from within the Main activity it creates a NullPointerException…
Nelson.b.austin
  • 3,080
  • 6
  • 37
  • 63
0
votes
2 answers

dynamically inflate xml file on condition

I have one EditText and user enter number lets say 5. Now I want to inflate one xml file in 5 times. My problem is xml file (which i inflate) have one Button Continue when user press it then I inflate it again. For Example, I have arralist with…
Hardik Joshi
  • 9,477
  • 12
  • 61
  • 113
0
votes
2 answers

How to inflate a child view?

I'm trying to inflate a particular section of a layout however I am getting compiler errors, and am unsure what approach to take. In particular with the line - LinearLayout childList = (LinearLayout)findViewById(R.id.listLayout). //(This can be…
Calgar99
  • 1,670
  • 5
  • 26
  • 42
0
votes
1 answer

Layoutinflator inflates mulitple buttons, how to make all others buttons invisible on click

I have the following issue, I inflate a layout which includes 2 buttons. The onClick method works fine and everything runs smoothly. However I would like to make both buttons that are inflated each time invisible once one of those two is being…
Max
  • 572
  • 2
  • 6
  • 23