Android Question Load an existing layout file into view

Vinians2006

Active Member
Licensed User
Longtime User
Hello
I already have a layout file and I want to make it scrollable. I tryed to put a ScrollView in the designer but the designer dont let me change the "parent" property. Then I tryed to create a ScrollView in runtime and load that layout into ScrollView.panel.loadLayout("dddd") but it give me an error. Any other way to make this to work ?
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
... but it give me an error.
Without seeing your code, or being given any information about the error, it is difficult to explain the problem. However here is an example that does do what you suggested. I constructed an oversized layout and loaded it to the Activity. Then I modified the app to load a scrollview at run-time and loaded the unmodified layout into the scrollview panel. So it can be done.

The "parent" shown in the designer is still "Activity", but that doesn't mean that the layout cannot be loaded to another view. For that reason I think that your first suggestion can also be made to work. Make a new layout with just a scrollview and load that to the activity, then load your existing layout to the scrollview panel. There is no need to change the "parent" shown in the Designer.
 

Attachments

  • scrollview.zip
    9.2 KB · Views: 95
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…