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

Programmatically change layout Ressource in Adapter

I am using an Adapter to display a list + a static button as a footerView. The Button as well as the List are Layout Ressource Files loaded via: LayoutInflater.from(parent.context).inflate(R.layout.recycler_button, parent, false) I now need to…
JVS
  • 2,592
  • 3
  • 19
  • 31
-1
votes
1 answer

Add components in Fragment at runtime in android studio

I've been struggling with finding an appropiate answer on how to add components to a layout in a fragment at runtime in android studio. Specifically: I have Class A which downloads and parses an XML file. Fragment B instantiates this Class A and…
-1
votes
1 answer

Reuse inflated view for multiple tabs

I'm writing an app with multiple tabs. Every tab is a fragment and every tab uses the same layout file. You can change to the next tab by swiping (handled by a SwipeAdapter). Inflating the same layout for every tab again is quite inefficient and…
Anaxastron
  • 15
  • 1
  • 6
-1
votes
1 answer

How to fix my LinearLayout to scroll down when content exceeds view

I am adding views to my adapter dynamically and when the views exceeds the screen boundaries I am unable to see the full views. I have tried android:isScrollContainer="true" and android:scrollbars="vertical" without any luck. public void…
-1
votes
1 answer

How to access 'findViewById' method inside Dialog onClick event

I'm having a custom layout xml file named login_form with a LinearLayout root named login_form_root. I'm trying to display this layout using dialog but can't get values from EditText as I get cannot resolve method findViewById inside…
PHP User
  • 2,350
  • 6
  • 46
  • 87
-1
votes
1 answer

LayoutInfalter push mylayout.xml to my view but without any content

I`m new here and need help. This my code. Activity class ProfileActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_profile) var…
-1
votes
1 answer

Layout inflater with DialogFragment

I'm trying to inflate my custom layout (a dialog fragment). I have this in my function showDialog() val inflatedView = layoutInflater.inflate(R.layout.alerts_dialog_remi, null) mydialog = Dialog(this, R.style.DialogCustomTheme) …
Projet Sin
  • 337
  • 8
  • 20
-1
votes
1 answer

Layout not inflating

the below code is used to create a list of notes. I want to take the title of the note and add to to the dynamic layout. but the layout is not inflating. public class TakeNote extends AppCompatActivity { List titles = new…
-1
votes
1 answer

android crash while inflating layout

i have this method for inflating and storing the views in a hashmap private void changeRecyclerViewHeader(int header) { if (recyclerViewHeaders.containsKey(header)) { _headerView = recyclerViewHeaders.get(header); } else { …
Nir Golan
  • 270
  • 1
  • 3
  • 15
-1
votes
1 answer

Inflate ListView in a custom PagerAdapter makes setAdapter call ineffective

I have tried to create a custom PagerAdapter since I want to show some pages, where each page contains a ListView, that should be initialized by the pager adapter constructor MyPagerAdapter, that receives the Activity where the ViewPager is used,…
-1
votes
2 answers

ListView crashes. Not working app. Android Studio Emulator

I built a ListView and when i try to run the app it keep saying that it won't load. it needs to close. So i can't run it on the Android Studio virtual device. import android.content.res.Resources; public class MainActivity4 extends…
-1
votes
2 answers

Android Adding view from inflate layout and how to update particular textview value in layout

I have created view from inflating separate layout. I used for loop to create view more than 5 view like an ListView. Here I want call balance check. Inside view, I will click balance button and once receive response from server, I want to update…
harikrishnan
  • 1,985
  • 4
  • 32
  • 63
-1
votes
1 answer

How to create Heterogenous Layouts from json response

Hi please help me inflate layout based on json response type I am trying to merge http://androidcss.com/android/fetch-json-data-android/ this tutorial with this https://github.com/codepath/android_guides/wiki/Heterogenous-Layouts-inside-RecyclerView…
Muhsin
  • 47
  • 3
  • 11
-1
votes
1 answer

Changing TextView text from another XML file

Im making DrawerLayout and it have more XML files for each part,so i only have 1 class and multiple XML files. Now i want to set TextView text of one XML file in my main activity and i tried using layout inflaters but it didnt work,it was giving me…
Praziluk
  • 21
  • 8
-1
votes
2 answers

LinearLayout, weightSum not working properly

I have a base activity and main activity but in main activity I have applied weightsum but its not working properly. Below is the expected and current output MainActivity.java public class MainActivity extends BaseActivity { LinearLayout…