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
1 answer

Parent Activity's code getting executed, but the result (animation) is not showing up

I want to have a sliding menu throughout my application which will be accessible for every activity in my application. For this, I created a parent activity to which all other activities extend as suggested in this answer. So that, only one activity…
Rajkiran
  • 15,845
  • 24
  • 74
  • 114
0
votes
1 answer

Android: LayoutInflater - adding a View

I have the following code, see below. I want to add a View programmatically to the inflated layout - because the View's size, I want to add to the layout, depends on another View's size which I am receiving in the ViewTree Observer (the on pre draw…
Bins Ich
  • 1,822
  • 6
  • 33
  • 47
0
votes
1 answer

Set LinearLayout's width inside TableRow to MATCH_PARENT

I have a TableLayout with MATCH_PARENT for width and by code I add a TableRow, that inflates a LinearLayout, all have MATCH_PARENT for width. If I remove the LinearLayout and I add the TextView to the TableRow directly it works fine. But finally,…
rbrlnx
  • 286
  • 7
  • 23
0
votes
2 answers

I need to add an EditText field with relative button when clicking on a "+" button

probably the title of my question is not really clear. I'm developing my first Android Application for a University project. What I need now is to give the possibility of entering one "ingredient" to my users in order to look for recipes in a…
0
votes
5 answers

how to add another view using layout inflatter

I created mainLayout with two buttons add: to add other layout remove : to remove other layout.
0
votes
2 answers

Dynamic textView error while clicking listView

I'm trying to have a dynamic textview based on the xml file..... Please help me with my code CODE MessageViewPage.java package com.dpn.pack; public class MessageViewPage extends Activity { TextView tv1=new TextView(this); ScrollView sv; String…
Dipin.K.G
  • 127
  • 10
0
votes
1 answer

Android - Adding inflated views to viewflipper

first off I apologise if it's a dumb question as I'm a noob when it comes to Android and StackOverflow too... I'm trying to read a twitter json feed and then push the various tweets into a ViewFlipper so it cycles horizontally between them...I just…
user1504495
  • 666
  • 8
  • 17
0
votes
1 answer

Android - Reuse inflated View

Following is a layout that I want to reuse
Anand Sunderraman
  • 7,900
  • 31
  • 90
  • 150
0
votes
1 answer

Injected views remain null for inflated layouts

Can I use Roboguice @InjectView on elements that are included in a layout that will be inflated? It seems right to me that the elements are declaired @Nullable at first, as they are not known until the inflate is done. But after inflate, the…
Mihaela Romanca
  • 1,368
  • 2
  • 14
  • 23
0
votes
2 answers

setImageResource in GridView makes holes

Hello everyone I have a problem. I want to do a GridView with a Custom Loyout so i used the layoutInflater and i did this: private ImageView prima; private ImageView seconda; public View getView(int position, View convertView, ViewGroup parent) { …
Matteo Cardellini
  • 876
  • 2
  • 17
  • 41
0
votes
1 answer

How to access a view that is not running?

So I've used this tutorial to create a custom toast, that will display an image. Now what I want to do is be able to pass in an image resource and tell my toast method to display that image. So I've got this: private void callToast(int…
dwjohnston
  • 11,163
  • 32
  • 99
  • 194
0
votes
2 answers

How do I inflate single cells in a TableLayout?

I want to inflate single cells of a TableLayout: The information I want to put in each cell has a fixed size I am using Adroid 2.2 The table should fill up in the following way: Like this: ___ ___ | 1 | 2 | |---+---| | 3 | 4 | |---+---| | 5…
0
votes
2 answers

Unable to start activity after return from background

My app works when initially run, however if it is left in the background for a while then relaunched by the user I get a RuntimeException "Unable to start activity ComponentInfo...Error inflating class fragment". The activity contains a fragment…
Arthur Thompson
  • 9,087
  • 4
  • 29
  • 33
0
votes
1 answer

Android, Scroll Menu with multiple views inside - Views from XML

Super newb here. Been searching for 4 hours on google and these forums and do not see this addressed. Sorry if it is, but like i said, SUPER newb here. I need a scroll view that has a linear layout in it. IN the linear layout I need customized…
user1318747
  • 345
  • 4
  • 12
0
votes
4 answers

Android : Fragment not working Runtime Exception arise

I have create a sample Fragment application. I have two fragments like list fragment and Detail fragment. code for fragment class: public class ListFragment1 extends ListFragment { @Override public void onCreate(Bundle savedInstanceState) { …
Sridhar
  • 2,228
  • 10
  • 48
  • 79