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
-2
votes
2 answers

Android - Inflating a view in a layout makes my layout transparent - How to stop this?

I am trying to inflate a view beneath my layout, but my to layout becomes transparent. Any idea why? Here is my mainActivity: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) …
RFM
  • 107
  • 7
-2
votes
2 answers

On Button click view is not removing from the parentView?

I am inflating a view from the parent view .it is inflating fine.the view is adding as many time i wanted ,but when i want to delete a particular view ,it's not removing that view. while that button is working on toasts.but not on removing…
itsandpro
  • 33
  • 8
-2
votes
2 answers

how to inflate recyclerviewadapter in recyclerview in fragment?

My SavedActivity.java: public class SavedActivity extends Fragment { private static final String MyApp = "/MyApp"; RecyclerView RecyclerViewMediaList; LinearLayoutManager mLinearLayoutManager; public SavedActivity() { // Required empty public…
-2
votes
2 answers

how to add same view on runtime

I want to design a view like this its the same view repeating multiple times,i.e. when clicked on add item , it should add same view(on the beginning there should be only one row). I don't understand how to make one, seems I can't make such view…
-2
votes
1 answer

LayoutInflator throws NullPointerException

I'm new to android. And I'm trying to manipulate the TextView from aother class out of the GUI class which is the MainActivity class. But it throws an exception. Following is the code i used... Context ctx; private SharedPreferences…
-2
votes
2 answers

Convert String "R.id.text1" to int id of TextView

MainActivity.java for(int i=1;i<=2;i++) { String commonId="R.id.text"; final int index=i-1; commonId=commonId+i; Log.e("MSG",index+" "+commonId); Integer id=…
Shivam
  • 1
  • 2
-2
votes
1 answer

Why can't we inflate a view into customview while that customview is initializing?

I created a customview that named PinView extended from RelativeLayout. In constructors, i call my init() method and it inflates a view from a layout. inflate(getContext(), R.layout.layout_pin_view, this); After this inflate flow, I need to add my…
atasoyh
  • 3,045
  • 6
  • 31
  • 57
-2
votes
4 answers

Are Views automatically inflated?

From what I understand, the LayoutInflater converts XML into Views. But when I use Buttons, TextViews or other widgets in code, I simply have to use findViewById() without having to inflate these Views first. Are these views automatically inflated?…
xasthor
  • 119
  • 3
-2
votes
2 answers

Dynamic inflating gives me a nullexception

I'm making a layout with a LinearLayout. This layout will have another layout inflated inside. Currently, I'm getting problems (nullexceptions) with that. My inflating code is the next: private void addLayoutInvoices() { LinearLayout…
-2
votes
1 answer

java.lang.RuntimeException: view android.widget.TextView being added, but it already has a parent

I am using broadcastreceiver to display the values from SMS where i am using WindowManager to display it. But i am getting an Runtime exception which says it already has parent. WindowManager windowManager = (WindowManager)…
-2
votes
1 answer

How to map variable and view in android?

I have a list of objects, I set them to view and insert to layout But I don't know how to identify which view for which object Is it possible to add additional attribute to view before I insert it to layout? For example: LayoutInflater…
CL So
  • 3,647
  • 10
  • 51
  • 95
-2
votes
1 answer

Why using LayoutInflater is not same to xml?

I created this layout
CL So
  • 3,647
  • 10
  • 51
  • 95
-2
votes
2 answers

Can we use LayoutInflater jump to other activity?

I know the LayoutInflater can load View dynamically.Can I jump to other View with LayoutInflater? I have write some code,but it doesn't work. setContentView(R.layout.activity_viewpager); button = (Button) findViewById(R.id.button); …
CoolEgos
  • 47
  • 1
  • 10
-2
votes
1 answer

How could I set a value on edittext

is it possible to set a value into a editable edittext like this? LayoutInflater layoutInflater = LayoutInflater.from(getBaseContext()); View promptView = layoutInflater.inflate(R.layout.prompt_dialog, null); final EditText input =…
-2
votes
1 answer

How can i close a setContentView or go back to previous layout inflated screen?

I'm beginning in Android Development and i need close a setContentView() called with a onClickListener() where myCurrent screen is a layout inflated over other Layout. Here is my code: public class MainActivity extends Activity { private…
1 2 3
81
82