Questions tagged [android-inflate]

Instantiates a layout XML file into its corresponding View objects

651 questions
1
vote
0 answers

NullPointerException: Attempt to invoke virtual method 'int android.view.ViewGroup.getPaddingBottom()' on a null object reference

Crashing when I am trying to inflate menu to BottomNavigationView but got crash on same. I have updated material design library from 'com.google.android.material:material:1.2.1' to 'com.google.android.material:material:1.6.1'. Note: Not crashing for…
1
vote
2 answers

getLayoutInflator() in Android

I have read the android documentation about getLayoutInflator and I am still not understanding what it does. Can someone give me a use case for this method or may be during what time would you want to call getLayoutInflator?
denniss
  • 17,229
  • 26
  • 92
  • 141
1
vote
0 answers

Fragment OnInflate never called

I'm trying to use the custom attributes but the onInflate method is never called. Here is my code: class NavigationBarFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, …
Edwin ZAP
  • 419
  • 1
  • 4
  • 16
1
vote
2 answers

inflating view vs inflating an element

I would like to inflate R.id.catText, but it doesn't ever show if I inflate it by itself. If I inflate R.id.assets (the container) then both elements show up just fine. I just don't want the container. How can I inflate R.id.catText without…
Jacksonkr
  • 31,583
  • 39
  • 180
  • 284
1
vote
1 answer

How to show Alert on top of all Activities in android?

I am doing an AsyncTask to call an API call in my application. And showing the API response as an Alert. I have written that API calls on home screen activity and showed that alert on top of the home screen. But if I moved from that activity to…
1
vote
0 answers

Why do i get an error when inflating a textview with a custom background?

I'm trying to inflate an XML, as an item for RecyclerView, the XML is Constraint Layout with two TextViews both TextViews have the same background that I created, it's located in the drawable folder and it's a rectangle shape, in order to create a…
Akiva
  • 3
  • 2
1
vote
0 answers

Could not inflate Behavior subclass custom class

I'm trying to implement this inside of my project: https://github.com/SergeyBurlaka/CollapsingAvatarToolbarSample In the xml file of my main fragment i have
giordy16
  • 275
  • 1
  • 12
1
vote
1 answer

Repeat an action inside of a service

From MainActivity I'm passing an intent to startService. That service is successfully started. On that service, there is a small rectangle of text ("hello, world") that is originally initialized in an XML layout. In the service code reproduced…
ni37osllb
  • 92
  • 1
  • 1
  • 9
1
vote
1 answer

Why is null in ViewPager method?

I have ViewPager. Every ViewPager's page is customView. In custom view class in addOnPageChangeListener(new ViewPager.OnPageChangeListener() method I get null. I can't understand why, because in other method with viewPager - setOnClickListener(new…
Monica
  • 384
  • 2
  • 4
  • 16
1
vote
0 answers

How to inflate RelativeLayout in custom ViewGroup

I have a custom animated ViewGroup (based heavily on SlidingTab). In my app, I've stripped this down to just a single TextView that behaves just like the SlidingTab (the slider on your lock screen). This works great, but the TextView that slides is…
1
vote
1 answer

How to resolve problem of inflateException when I include a layout?

I design a new form name (form_info.xml) to get some information from user then I tried to include the form to activity_main.xml but unfortunately app crashed and I got inflateExcdeption but I don't know how to handle it. Also when I add my new form…
1
vote
0 answers

FragmentContainerView: Fragment from NavigationGraph does not inflate

So, I was following the Google's Kotlin Fundamental Course and on topic 3.2 (Add Navigation Drawer), creating the XML file where I added a fragment as NavHostFragment, it gave me a warning to replace it with FragmentContainerView which I ignored but…
1
vote
1 answer

What's good approach, InflateView/ removeView OR setting Visibility.GONE?

I've got a fragment with a view having a skeleton view on it. Skeleton/Shimmering view is shown only once when data is in the loading state and then it is hidden. I'm using that fragment in ViewPager2. In order to make scrolling of ViewPager2 more…
1
vote
1 answer
1
vote
1 answer

Possible to get reference to a View without setting the ContentView of an Activity

I want to be able to get reference to a RelativeLayout in the same way as RelativeLayout relative = (RelativeLayout)findViewById(R.id.relative); but without setting the ContentView of the Activity. I think it may have something to do with Infalter?…