Questions tagged [viewstub]

A ViewStub is an invisible, zero-sized View that can be used to lazily inflate layout resources at runtime. When a ViewStub is made visible, or when inflate() is invoked, the layout resource is inflated. The ViewStub then replaces itself in its parent with the inflated View or Views. Therefore, the ViewStub exists in the view hierarchy until setVisibility(int) or inflate() is invoked. The inflated View is added to the ViewStub's parent with the ViewStub's layout parameters. Similarly, you can define/override the inflate View's id by using the ViewStub's inflatedId property

Basic Questions..

How to use ViewStub? How to find access to button in viewStub?

109 questions
0
votes
1 answer

Barrier not working with viewstub, too much padding

I am trying to use a barrier in combination with a viewstub which inflates a textinputlayout. The problem is that when the text error is set (e.g the user put something wrong in it), the padding gets absolutely messed up. I will provide the code and…
Andrew
  • 4,264
  • 1
  • 21
  • 65
0
votes
1 answer

prefixtext changes textInputlayout hight and makes it huge

I am using a textinputlayout in combination with a textinputedittext as a layout for my viewstub. Everything works fine, until I try to add a prefixtext. With this, the layout gets messed up and the textInputLayout is huge. I will provide my code…
0
votes
1 answer

Viewstub cannot pass stringresource to databinding

I am trying to pass a "@string" and "@stringarray" to my viewstub databinding via xml, but it does not work. I get the following error…
Andrew
  • 4,264
  • 1
  • 21
  • 65
0
votes
1 answer

ViewStub inflation of ConstraintLayout

I want to leverage ViewStub to optionally show a portion of UI. When the root of my inflated item is ConstraintLayout then it doesn't render. But if that root is MaterialCardView then it displays as intended.
es0329
  • 1,366
  • 1
  • 18
  • 35
0
votes
0 answers

how to get layout and elements inside ViewStub (generated from SDK) in android programmatically?

I am using an SDK which is displaying a popup on performing some action in app. By using WindowManager i am able to get views on the screen as: 1) My home screen (android.view.ViewRootImpl@e33bea5: DecorView@82c1e88[Dashboard]) 2) Login success…
0
votes
1 answer

ViewStub'parent viewgroup

What is the meaning of that exception ava.lang.IllegalStateException: ViewStub must have a non-null ViewGroup viewParent i am creating an array of View Stub and adding them to a linearLayout but this exception is showing at run time for(int…
Tofeeq Ahmad
  • 11,935
  • 4
  • 61
  • 87
0
votes
2 answers

reinflating Viewstub

I have a problem. I slip my Screen in two areas with 2 ViewStubs. But if i inflated the ViewStubs they are no more accessible and i can't inflate an other View within this ViewStub. So what is an alternative to use these kind containers. Here some…
passsy
  • 5,162
  • 4
  • 39
  • 65
0
votes
1 answer

Kotlin Android - ViewStub must not be null

I'm using a ViewStub to dynamically inflate layout to a bottom sheet. Everything works fine, except that when the ViewStub once inflated can't be used in code. For example, once I've inflated a layout (using View.VISIBLE, not .inflate() I can't use…
Arfmann
  • 684
  • 9
  • 30
0
votes
1 answer

Image in LinearLayout not resizing well

I have a page called 'SimpleResultPage'. In this page I display a detail view from different kind of items i have in my app. At the start of the activity I determine what kind of items it should display and based on that I hide/show…
Galip
  • 5,435
  • 10
  • 37
  • 47
0
votes
1 answer

ViewStub parent goes null

I have a ViewHolder that contains a ViewStub, when I want to bind data into my view, I first check that is viewStub inflated before or not? if (mViewStub != null) //still not inflated then if mViewStub still not inflated, I try to inflate this…
SamiAzar
  • 1,260
  • 13
  • 29
0
votes
1 answer

how to use ViewStub in keyboard layout

I want to use ViewStub in keyboard.xml I have a layout which has a key of the keyboard, see screenshot when I am going to open keyboard it takes some time to open because of loading this much views. For that I used ViewStub, but it will not reduce…
Priyanka
  • 3,369
  • 1
  • 10
  • 33
0
votes
1 answer

Kotlin - java.lang.IllegalStateException: ViewStub must have a non-null ViewGroup viewParent

I'm using ViewStub to change layout with a Spinner keeping the base of the main layout Here's the code: val viewStub = findViewById(R.id.layout_stub) val layoutParams =…
Arfmann
  • 353
  • 1
  • 7
  • 18
0
votes
1 answer

Finding controls inside a ViewStub Android

I have a fragment and I want to use a ViewStub for some data. The problem I have is once I have inflated the ViewStub from the fragments Java class, how can I reference in the fragments java class components inside the ViewStub? For example I…
Carl Bruiners
  • 516
  • 1
  • 7
  • 21
0
votes
1 answer

Android ViewStub manage replace inner Views

i am testing with the ViewStub Android component. I am able to inflate a View and replace by a new one, but when i perform a replace of the existing View by a new one, i suspect that the destroyer is never called at the old replaced Views. Here is…
Billyjoker
  • 729
  • 1
  • 10
  • 31
0
votes
1 answer

Inflate ViewStub to cover entire content view

I would like to inflate a ViewStub to cover the entire content view. The ViewStub is contained in the Activity's CoordinatorLayout root view. Additionally, the Activity's layout contains a Toolbar set as an ActionBar via…
Orbit
  • 2,985
  • 9
  • 49
  • 106