We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Scroll container not expanding to width of container
```
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW

class AFV(toga.App):

    def startup(self):
        self.main_window = toga.MainWindow(title=self.formal_name)

        box_test = toga.Box(style=Pack(direction=COLUMN, padding=5))
        self.label_1 = toga.Label('TESTE 1')
        self.lineEdit_1 = toga.TextInput()
        self.label_2 = toga.Label('TESTE 2')
        self.lineEdit_2 = toga.TextInput()
        self.label_3 = toga.Label('TESTE 3')
        self.lineEdit_3 = toga.TextInput()
        self.label_4 = toga.Label('TESTE 4')
        self.lineEdit_4 = toga.TextInput()
        self.label_5 = toga.Label('TESTE 5')
        self.lineEdit_5 = toga.TextInput()

        box_test.add(self.label_1, self.lineEdit_1, 
                     self.label_2, self.lineEdit_2, 
                     self.label_3, self.lineEdit_3, 
                     self.label_4, self.lineEdit_4, 
                     self.label_5, self.lineEdit_5)
        self.container = toga.ScrollContainer(horizontal=True, vertical=True)
        self.container.content = box_test


        self.main_window.content = self.container
        self.main_window.show()


def main():
    return AFV()
```


When using the widget it leaves the widgets in the wrong shape and size on the screen.
The ScrollContainer doesn't make the TextInput widget fill to the bottom of the screen, it measures according to the size of the Label text.

![qqqq](https://user-images.githubusercontent.com/75274707/194348453-3328a915-087a-4621-a86d-8a20a754c3a9.PNG)

Worked on Briefcase 0.3.9; new screenshot is from Briefcase 0.3.10.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/android/toga_android/widgets/scrollcontainer.py`
Content:
```
1 from travertino.size import at_least
2 
3 from toga_android.window import AndroidViewport
4 
5 from ..libs.android.view import (
6     Gravity,
7     View__MeasureSpec,
8     View__OnTouchListener
9 )
10 from ..libs.android.widget import (
11     HorizontalScrollView,
12     LinearLayout__LayoutParams,
13     ScrollView
14 )
15 from .base import Widget
16 
17 
18 class TogaOnTouchListener(View__OnTouchListener):
19     is_scrolling_enabled = True
20 
21     def __init__(self):
22         super().__init__()
23 
24     def onTouch(self, view, motion_event):
25         if self.is_scrolling_enabled:
26             return view.onTouchEvent(motion_event)
27         else:
28             return True
29 
30 
31 class ScrollContainer(Widget):
32     vScrollListener = None
33     hScrollView = None
34     hScrollListener = None
35 
36     def create(self):
37         vScrollView = ScrollView(self._native_activity)
38         vScrollView_layout_params = LinearLayout__LayoutParams(
39             LinearLayout__LayoutParams.MATCH_PARENT,
40             LinearLayout__LayoutParams.MATCH_PARENT
41         )
42         vScrollView_layout_params.gravity = Gravity.TOP
43         vScrollView.setLayoutParams(vScrollView_layout_params)
44         self.vScrollListener = TogaOnTouchListener()
45         self.vScrollListener.is_scrolling_enabled = self.interface.vertical
46         vScrollView.setOnTouchListener(self.vScrollListener)
47         self.native = vScrollView
48         self.hScrollView = HorizontalScrollView(self._native_activity)
49         hScrollView_layout_params = LinearLayout__LayoutParams(
50             LinearLayout__LayoutParams.MATCH_PARENT,
51             LinearLayout__LayoutParams.MATCH_PARENT
52         )
53         hScrollView_layout_params.gravity = Gravity.LEFT
54         self.hScrollListener = TogaOnTouchListener()
55         self.hScrollListener.is_scrolling_enabled = self.interface.horizontal
56         self.hScrollView.setOnTouchListener(self.hScrollListener)
57         vScrollView.addView(self.hScrollView, hScrollView_layout_params)
58         if self.interface.content is not None:
59             self.set_content(self.interface.content)
60 
61     def set_content(self, widget):
62         widget.viewport = AndroidViewport(widget.native)
63         content_view_params = LinearLayout__LayoutParams(
64             LinearLayout__LayoutParams.MATCH_PARENT,
65             LinearLayout__LayoutParams.MATCH_PARENT
66         )
67         if widget.container:
68             widget.container = None
69         if self.interface.content:
70             self.hScrollView.removeAllViews()
71         self.hScrollView.addView(widget.native, content_view_params)
72         for child in widget.interface.children:
73             if child._impl.container:
74                 child._impl.container = None
75             child._impl.container = widget
76 
77     def set_vertical(self, value):
78         self.vScrollListener.is_scrolling_enabled = value
79 
80     def set_horizontal(self, value):
81         self.hScrollListener.is_scrolling_enabled = value
82 
83     def set_on_scroll(self, on_scroll):
84         self.interface.factory.not_implemented("ScrollContainer.set_on_scroll()")
85 
86     def get_vertical_position(self):
87         self.interface.factory.not_implemented(
88             "ScrollContainer.get_vertical_position()"
89         )
90         return 0
91 
92     def set_vertical_position(self, vertical_position):
93         self.interface.factory.not_implemented(
94             "ScrollContainer.set_vertical_position()"
95         )
96 
97     def get_horizontal_position(self):
98         self.interface.factory.not_implemented(
99             "ScrollContainer.get_horizontal_position()"
100         )
101         return 0
102 
103     def set_horizontal_position(self, horizontal_position):
104         self.interface.factory.not_implemented(
105             "ScrollContainer.set_horizontal_position()"
106         )
107 
108     def rehint(self):
109         # Android can crash when rendering some widgets until they have their layout params set. Guard for that case.
110         if not self.native.getLayoutParams():
111             return
112         self.native.measure(
113             View__MeasureSpec.UNSPECIFIED,
114             View__MeasureSpec.UNSPECIFIED,
115         )
116         self.interface.intrinsic.width = at_least(self.native.getMeasuredWidth())
117         self.interface.intrinsic.height = at_least(self.native.getMeasuredHeight())
118
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/android/toga_android/widgets/scrollcontainer.py b/src/android/toga_android/widgets/scrollcontainer.py
--- a/src/android/toga_android/widgets/scrollcontainer.py
+++ b/src/android/toga_android/widgets/scrollcontainer.py
@@ -59,7 +59,7 @@
             self.set_content(self.interface.content)
 
     def set_content(self, widget):
-        widget.viewport = AndroidViewport(widget.native)
+        widget.viewport = AndroidViewport(self.native)
         content_view_params = LinearLayout__LayoutParams(
             LinearLayout__LayoutParams.MATCH_PARENT,
             LinearLayout__LayoutParams.MATCH_PARENT

{"golden_diff": "diff --git a/src/android/toga_android/widgets/scrollcontainer.py b/src/android/toga_android/widgets/scrollcontainer.py\n--- a/src/android/toga_android/widgets/scrollcontainer.py\n+++ b/src/android/toga_android/widgets/scrollcontainer.py\n@@ -59,7 +59,7 @@\n             self.set_content(self.interface.content)\n \n     def set_content(self, widget):\n-        widget.viewport = AndroidViewport(widget.native)\n+        widget.viewport = AndroidViewport(self.native)\n         content_view_params = LinearLayout__LayoutParams(\n             LinearLayout__LayoutParams.MATCH_PARENT,\n             LinearLayout__LayoutParams.MATCH_PARENT\n", "issue": "Scroll container not expanding to width of container\n```\r\nimport toga\r\nfrom toga.style import Pack\r\nfrom toga.style.pack import COLUMN, ROW\r\n\r\nclass AFV(toga.App):\r\n\r\n    def startup(self):\r\n        self.main_window = toga.MainWindow(title=self.formal_name)\r\n\r\n        box_test = toga.Box(style=Pack(direction=COLUMN, padding=5))\r\n        self.label_1 = toga.Label('TESTE 1')\r\n        self.lineEdit_1 = toga.TextInput()\r\n        self.label_2 = toga.Label('TESTE 2')\r\n        self.lineEdit_2 = toga.TextInput()\r\n        self.label_3 = toga.Label('TESTE 3')\r\n        self.lineEdit_3 = toga.TextInput()\r\n        self.label_4 = toga.Label('TESTE 4')\r\n        self.lineEdit_4 = toga.TextInput()\r\n        self.label_5 = toga.Label('TESTE 5')\r\n        self.lineEdit_5 = toga.TextInput()\r\n\r\n        box_test.add(self.label_1, self.lineEdit_1, \r\n                     self.label_2, self.lineEdit_2, \r\n                     self.label_3, self.lineEdit_3, \r\n                     self.label_4, self.lineEdit_4, \r\n                     self.label_5, self.lineEdit_5)\r\n        self.container = toga.ScrollContainer(horizontal=True, vertical=True)\r\n        self.container.content = box_test\r\n\r\n\r\n        self.main_window.content = self.container\r\n        self.main_window.show()\r\n\r\n\r\ndef main():\r\n    return AFV()\r\n```\r\n\r\n\r\nWhen using the widget it leaves the widgets in the wrong shape and size on the screen.\r\nThe ScrollContainer doesn't make the TextInput widget fill to the bottom of the screen, it measures according to the size of the Label text.\r\n\r\n![qqqq](https://user-images.githubusercontent.com/75274707/194348453-3328a915-087a-4621-a86d-8a20a754c3a9.PNG)\r\n\r\nWorked on Briefcase 0.3.9; new screenshot is from Briefcase 0.3.10.\n", "before_files": [{"content": "from travertino.size import at_least\n\nfrom toga_android.window import AndroidViewport\n\nfrom ..libs.android.view import (\n    Gravity,\n    View__MeasureSpec,\n    View__OnTouchListener\n)\nfrom ..libs.android.widget import (\n    HorizontalScrollView,\n    LinearLayout__LayoutParams,\n    ScrollView\n)\nfrom .base import Widget\n\n\nclass TogaOnTouchListener(View__OnTouchListener):\n    is_scrolling_enabled = True\n\n    def __init__(self):\n        super().__init__()\n\n    def onTouch(self, view, motion_event):\n        if self.is_scrolling_enabled:\n            return view.onTouchEvent(motion_event)\n        else:\n            return True\n\n\nclass ScrollContainer(Widget):\n    vScrollListener = None\n    hScrollView = None\n    hScrollListener = None\n\n    def create(self):\n        vScrollView = ScrollView(self._native_activity)\n        vScrollView_layout_params = LinearLayout__LayoutParams(\n            LinearLayout__LayoutParams.MATCH_PARENT,\n            LinearLayout__LayoutParams.MATCH_PARENT\n        )\n        vScrollView_layout_params.gravity = Gravity.TOP\n        vScrollView.setLayoutParams(vScrollView_layout_params)\n        self.vScrollListener = TogaOnTouchListener()\n        self.vScrollListener.is_scrolling_enabled = self.interface.vertical\n        vScrollView.setOnTouchListener(self.vScrollListener)\n        self.native = vScrollView\n        self.hScrollView = HorizontalScrollView(self._native_activity)\n        hScrollView_layout_params = LinearLayout__LayoutParams(\n            LinearLayout__LayoutParams.MATCH_PARENT,\n            LinearLayout__LayoutParams.MATCH_PARENT\n        )\n        hScrollView_layout_params.gravity = Gravity.LEFT\n        self.hScrollListener = TogaOnTouchListener()\n        self.hScrollListener.is_scrolling_enabled = self.interface.horizontal\n        self.hScrollView.setOnTouchListener(self.hScrollListener)\n        vScrollView.addView(self.hScrollView, hScrollView_layout_params)\n        if self.interface.content is not None:\n            self.set_content(self.interface.content)\n\n    def set_content(self, widget):\n        widget.viewport = AndroidViewport(widget.native)\n        content_view_params = LinearLayout__LayoutParams(\n            LinearLayout__LayoutParams.MATCH_PARENT,\n            LinearLayout__LayoutParams.MATCH_PARENT\n        )\n        if widget.container:\n            widget.container = None\n        if self.interface.content:\n            self.hScrollView.removeAllViews()\n        self.hScrollView.addView(widget.native, content_view_params)\n        for child in widget.interface.children:\n            if child._impl.container:\n                child._impl.container = None\n            child._impl.container = widget\n\n    def set_vertical(self, value):\n        self.vScrollListener.is_scrolling_enabled = value\n\n    def set_horizontal(self, value):\n        self.hScrollListener.is_scrolling_enabled = value\n\n    def set_on_scroll(self, on_scroll):\n        self.interface.factory.not_implemented(\"ScrollContainer.set_on_scroll()\")\n\n    def get_vertical_position(self):\n        self.interface.factory.not_implemented(\n            \"ScrollContainer.get_vertical_position()\"\n        )\n        return 0\n\n    def set_vertical_position(self, vertical_position):\n        self.interface.factory.not_implemented(\n            \"ScrollContainer.set_vertical_position()\"\n        )\n\n    def get_horizontal_position(self):\n        self.interface.factory.not_implemented(\n            \"ScrollContainer.get_horizontal_position()\"\n        )\n        return 0\n\n    def set_horizontal_position(self, horizontal_position):\n        self.interface.factory.not_implemented(\n            \"ScrollContainer.set_horizontal_position()\"\n        )\n\n    def rehint(self):\n        # Android can crash when rendering some widgets until they have their layout params set. Guard for that case.\n        if not self.native.getLayoutParams():\n            return\n        self.native.measure(\n            View__MeasureSpec.UNSPECIFIED,\n            View__MeasureSpec.UNSPECIFIED,\n        )\n        self.interface.intrinsic.width = at_least(self.native.getMeasuredWidth())\n        self.interface.intrinsic.height = at_least(self.native.getMeasuredHeight())\n", "path": "src/android/toga_android/widgets/scrollcontainer.py"}], "after_files": [{"content": "from travertino.size import at_least\n\nfrom toga_android.window import AndroidViewport\n\nfrom ..libs.android.view import (\n    Gravity,\n    View__MeasureSpec,\n    View__OnTouchListener\n)\nfrom ..libs.android.widget import (\n    HorizontalScrollView,\n    LinearLayout__LayoutParams,\n    ScrollView\n)\nfrom .base import Widget\n\n\nclass TogaOnTouchListener(View__OnTouchListener):\n    is_scrolling_enabled = True\n\n    def __init__(self):\n        super().__init__()\n\n    def onTouch(self, view, motion_event):\n        if self.is_scrolling_enabled:\n            return view.onTouchEvent(motion_event)\n        else:\n            return True\n\n\nclass ScrollContainer(Widget):\n    vScrollListener = None\n    hScrollView = None\n    hScrollListener = None\n\n    def create(self):\n        vScrollView = ScrollView(self._native_activity)\n        vScrollView_layout_params = LinearLayout__LayoutParams(\n            LinearLayout__LayoutParams.MATCH_PARENT,\n            LinearLayout__LayoutParams.MATCH_PARENT\n        )\n        vScrollView_layout_params.gravity = Gravity.TOP\n        vScrollView.setLayoutParams(vScrollView_layout_params)\n        self.vScrollListener = TogaOnTouchListener()\n        self.vScrollListener.is_scrolling_enabled = self.interface.vertical\n        vScrollView.setOnTouchListener(self.vScrollListener)\n        self.native = vScrollView\n        self.hScrollView = HorizontalScrollView(self._native_activity)\n        hScrollView_layout_params = LinearLayout__LayoutParams(\n            LinearLayout__LayoutParams.MATCH_PARENT,\n            LinearLayout__LayoutParams.MATCH_PARENT\n        )\n        hScrollView_layout_params.gravity = Gravity.LEFT\n        self.hScrollListener = TogaOnTouchListener()\n        self.hScrollListener.is_scrolling_enabled = self.interface.horizontal\n        self.hScrollView.setOnTouchListener(self.hScrollListener)\n        vScrollView.addView(self.hScrollView, hScrollView_layout_params)\n        if self.interface.content is not None:\n            self.set_content(self.interface.content)\n\n    def set_content(self, widget):\n        widget.viewport = AndroidViewport(self.native)\n        content_view_params = LinearLayout__LayoutParams(\n            LinearLayout__LayoutParams.MATCH_PARENT,\n            LinearLayout__LayoutParams.MATCH_PARENT\n        )\n        if widget.container:\n            widget.container = None\n        if self.interface.content:\n            self.hScrollView.removeAllViews()\n        self.hScrollView.addView(widget.native, content_view_params)\n        for child in widget.interface.children:\n            if child._impl.container:\n                child._impl.container = None\n            child._impl.container = widget\n\n    def set_vertical(self, value):\n        self.vScrollListener.is_scrolling_enabled = value\n\n    def set_horizontal(self, value):\n        self.hScrollListener.is_scrolling_enabled = value\n\n    def set_on_scroll(self, on_scroll):\n        self.interface.factory.not_implemented(\"ScrollContainer.set_on_scroll()\")\n\n    def get_vertical_position(self):\n        self.interface.factory.not_implemented(\n            \"ScrollContainer.get_vertical_position()\"\n        )\n        return 0\n\n    def set_vertical_position(self, vertical_position):\n        self.interface.factory.not_implemented(\n            \"ScrollContainer.set_vertical_position()\"\n        )\n\n    def get_horizontal_position(self):\n        self.interface.factory.not_implemented(\n            \"ScrollContainer.get_horizontal_position()\"\n        )\n        return 0\n\n    def set_horizontal_position(self, horizontal_position):\n        self.interface.factory.not_implemented(\n            \"ScrollContainer.set_horizontal_position()\"\n        )\n\n    def rehint(self):\n        # Android can crash when rendering some widgets until they have their layout params set. Guard for that case.\n        if not self.native.getLayoutParams():\n            return\n        self.native.measure(\n            View__MeasureSpec.UNSPECIFIED,\n            View__MeasureSpec.UNSPECIFIED,\n        )\n        self.interface.intrinsic.width = at_least(self.native.getMeasuredWidth())\n        self.interface.intrinsic.height = at_least(self.native.getMeasuredHeight())\n", "path": "src/android/toga_android/widgets/scrollcontainer.py"}]}