I am working on an application and should add a text box to the view when the button is selected. How can I do this or add any object dynamically. Which class do I use or what method do I need to call? Thank.
You just need to call the method addViewfor the target view. This is a method inherited from ViewGroup , see [Here] [2].
addView
[2]: http://developer.android.com/reference/android/view/ViewGroup.html#addView (android.view.View, android.view.ViewGroup.LayoutParams)
One possibility is to define it in your XML layout and set:
android:visibility="gone"
:
TextView myTextBox = (TextView) findViewById(R.id.myTextBoxId); myTextBox.setVisibility(View.VISIBLE);
myTextBox.setVisibility(View.GONE);
Source: https://habr.com/ru/post/1784316/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1784311/how-to-send-simulated-keyboard-strokes-to-the-active-window-using-sendkeys&usg=ALkJrhgB5zgaIpR9-hBlBYJMUhTOy-Zu6ADrowning a file from server to client with servlet - javaGeospatial Indexing with Redis & Sinatra for Facebook - indexingHow do you vertically center legends using the Google Graphics API? - graphHow to remove jstring sent from Native Code back to Java? - c ++Python Fast Monochrome Bitmap - performanceWhat happened to my regex? - regexInterface Size for iPhone for iPhone - iphoneThe most elegant way to return a value from jQuery $ .each? - javascript"Cannot open image" error when using ImageMagick Filename Links - referenceAll Articles