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

LayoutInflater NullPointerException

I am trying to refresh my custom ListViewAdapter; Edit : When I click an item in Listview it is calling the GoruntuleActivity's screen and creating oncreate method (I am assuming it is creating..) and then I call a method of GoruntuleActivity and…
Merve Gül
  • 1,377
  • 6
  • 23
  • 40
0
votes
1 answer

Android OptionsMenu, add items on runtime

I've got an optionsmenu looking like this right now: Lets say that if I click item 1, i want two new items added to the menu looking like this: I'm having problems doing this at runtime(while it's open) since onCreateOptionsMenu is only called…
0
votes
1 answer

preserve state of elements inside listview's each row

I have designed a listview by inflating each row using inflater and I have changed color of convertView's elements on their click events. But after scrolling the list the elements loss these changes. How can I "preserve" their state and represent…
Mehul Joisar
  • 15,348
  • 6
  • 48
  • 57
0
votes
1 answer

LayoutInflater, Open layout with activity within RelativeLayout

I have a "Tools.java" that shows "tools.xml" correct? Within this "tools.xml" RelativeLayout have a layout id = @+/contentLayout that is empty. And I have several other activits "tool1.java", "tools2.java" ... that shows "tool1.xml", "tool2.xml"…
GDawson
  • 3
  • 1
  • 6
0
votes
1 answer

Activity in dialog

I want to show an activity in dialog as shown in the picture below. Does any one know how can to achieve this result? I tried using this code for that activity but it didn't help me. android:theme="@android:style/Theme.Dialog" It shows in middle…
Chirag Patel
  • 11,416
  • 3
  • 26
  • 38
-1
votes
3 answers

How do use the LayoutInflater inflater properly

I created the Layout design using java code only not from the XML Layout Designs. The code I used is following public View getView(int position, View convertView, ViewGroup parent) { TextView tv = new TextView(mContext); …
aditi
  • 39
  • 3
  • 10
-1
votes
1 answer

Layout doesn't inflate in Android Studio MainActivity when it contains a Fragment Container View

I have the same problem like in this post, but in other way: I use a button from inside a fragment to inflate a different layout in MainActivity using the interface communication. It works when the layout contains only a TextView, but when I replace…
-1
votes
1 answer

LayoutInflater ignores XML attributes

I have a problem with my LayoutInflater. First of all here is my item.xml:
HavanaSun
  • 446
  • 3
  • 12
  • 39
-1
votes
1 answer

how convert LinearLayout to Bitmap without reshaping in android?

i'm developing an app for pax printer, so i need to convert my xml Layout(Linear,Relative,...) to Bitmap,my problem is when i convert any layout to image, the Created Bitmap width size is reshaped. why this happens? how i can solve this…
-1
votes
1 answer

onClickListener() is not working after I inflate the current view(activity_main)

what i'm trying to do is to run a while loop and print the text inside a textview, however it's working only for the first time then in the second time onClickListener() is not working. This is my MainActivity code. import…
-1
votes
1 answer

The LayoutInflater in android can't add child programatically?

I have a LinearLayout and I want to add my new programatically added CardView inside it as a child using the LayoutInflater llMain = (LinearLayout)findViewById(R.id.llMain); LayoutInflater inflater = getLayoutInflater(); Bundle extras =…
Fidz
  • 89
  • 9
-1
votes
1 answer

How to lazy initialize / inflate NavigationView

I started to profile my apps startup, and looks like side drawer com.google.android.material.navigation.NavigationView takes quite a lot of time to inflate. As the NavigationView is hidden when the app is started, I think it should be ok to delay…
devha
  • 3,307
  • 4
  • 28
  • 52
-1
votes
1 answer

Layout image source Is not changing in ImageView after using Layout Inflater

I am trying to change the image in an ImageView of a different layout. For this, I am using Layout Inflator, because I don't know any other way. The image gets visible when users click a button and according to the selected button, image gets…
-1
votes
2 answers

the layoutInflater.inflate() method can't resolve the layoutName

i'm making a custom listView but when make the inflater it can't resolve the "row" layout @Override public View getView(int i, View view, ViewGroup viewGroup) { LayoutInflater layoutInflater = getLayoutInflater(); …
-1
votes
1 answer

How to fix "Method findViewById must be called from the UI thread, currently inferred thread is worker thread less"

I am working on layout inflater for designing multiple JSON array insted of using nested listview,How Can i set inflater for multiple array response from json? I have used layout inflater method Layout inflater…
dipali
  • 59
  • 9