Questions tagged [android-inflate]

Instantiates a layout XML file into its corresponding View objects

651 questions
2
votes
0 answers

Unable to inflate layout after removing it

I want to inflate layout multiple times and it should get removed also whenever clicked on remove layout. Now I am able to add and remove the layout but unable to add again after removing the layout. If I don't remove and add another layout its…
user5669913
2
votes
1 answer

Android while using cardview image is loading very lazy

I am loading pictures (below ~3MB in size) into Cardview from a database and it was infalte in Listviewstview. The loading and browsing of these pictures is way too slow. Is there any method to downscale these pictures to speed up & sometimes…
2
votes
1 answer

How can i set inflated view width, half of it's parent?

I inflate the view in this method: public TabViewHolder onCreateViewHolder(ViewGroup parent, int viewType){ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.tabs_layout, parent, false); return new…
2
votes
2 answers

Android: inflated elements not in material design

Okay, so that's the problem: When I try to create dynamically some checkboxes, they don't get the material theme even if I'm inflating them from an xml file. EDIT: java: setContentView(R.layout.activity_volumi); FloatingActionButton add =…
2
votes
2 answers

Android ViewPager crash: InflateException: Binary XML file line #7: Error inflating class

I have created a slideshow using ViewPager, it works ok, but it crashes my app sometimes. There are only 3 pics loaded into it, I use a Timer to make it scroll automatically, onPause I cancel the timer. I don't really understand why does it crash…
2
votes
3 answers

How to measure view or view group inflating time in android?

I am looking for utility or any way how can I measure the time required for inflater to inflate some portion (view or viewgroup or whole screen) in Android. I know there is default feature in debug mode that shows overdraw, but I need to have…
user4881271
2
votes
1 answer

Android inflated textview ignores width

I have a layout in a layout xml file. I have it with fixed width 110dp. Inside the layout I have a TextView with fixed width 100dp. When I inflate the view with a LayoutInflater and add it in a LinearLayout, the TextView and it's parent…
Panos
  • 7,227
  • 13
  • 60
  • 95
2
votes
2 answers

Android menu items not getting inflated ever

I am making an android app and I am trying to apply some java code to the xml menu items but they are not getting inflated. I have some menu items defined within my menu xml file (stored in res/menu/main.xml) defined as follows:
kabeersvohra
  • 1,049
  • 1
  • 14
  • 31
2
votes
1 answer

Create/Add view pagers programmatically

I am having trouble creating and adding a view pager programmatically. I have found this question Android create ViewPager programmatically but the accepted answer doesnt work for me. Here is the relative code. ImagesPagerAdapter…
2
votes
2 answers

Can't get individual references to views when inflating multiple instances

My intent is to inflate numerous instances of the same view on a LinearLayout, and then modify their views accordingly. However, whenever I inflate a view multiple times, I always end up with the same reference to the first inflated view. Simplified…
2
votes
2 answers

inflate a view without XML in Android

first of all, please any one can tell me is it possible to inflate a view without XML ? Description is like this: I have dynamically generated a view hierarchy by coding, like Relative layout contain 4 Linear layouts -1st Linear Layout contain…
akash kubavat
  • 847
  • 6
  • 17
2
votes
1 answer

Android Wear: error inflating android.support.wearable.view.WatchViewStub

I get following error message when starting my Wearable demo app: "Error inflating class android.support.wearable.view.WatchViewStub" Exception Stack Trace: FATAL EXCEPTION: main Process: com.example.demowearapp, PID: 1503 …
user2368140
2
votes
1 answer

Inflator throws NumberFormatException: Invalid int: 20.0dip on Samsung Galaxy Tab 2

App runs well on other Android devices, only crashes when running on Samsung Galaxy Tab 2. Thought it has something to do with unsupported ActionBarSherlock, so I've disabled all custom styles, didn't help. Full stacktrace - 01-01 12:05:43.480:…
Kof
  • 23,893
  • 9
  • 56
  • 81
2
votes
1 answer

Calculation on textwatcher not working properly in android

I have made an android activity,In that multiple LinearLayouts are inflated on a "plus" button,Now in each Layout i am having 2 edittext and a textView,I want to do multiplication of that edittexts and display to textView,its working fine,But i am…
user3820044
  • 177
  • 1
  • 3
  • 20
2
votes
2 answers

Inflate child with 0dp layout width & weight (programmatically)

Simple: I want to inflate parent with 1 child which has 0dp width. Parent xml:
Diolor
  • 13,181
  • 30
  • 111
  • 179