Skip to content

Commit 650b409

Browse files
dellis1972jonpryor
authored andcommitted
[tests] Fix Layout so the test app actually runs (#2720)
Currently when running the `Mono.Android-Test` app we get the following error: Java.Lang.RuntimeException: Binary XML file line #1: You must supply a layout_width attribute. This is because `ScrollView` now needs to have the properties `//@android:layout_width` and `//@android:layout_height`. Once we provide those, we then get: Scrollview can host only one direct child We then need to add a `LinearLayout` to the `ScrollView` so that it removes that error as well.
1 parent d7ce336 commit 650b409

File tree

4 files changed

+119
-97
lines changed

4 files changed

+119
-97
lines changed

src/Mono.Android/Test/Resources/layout/Main.axml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,26 @@
1818
android:editable="false"
1919
/>
2020
<ScrollView
21-
android:id="@+id/my_scroll_view">
22-
<TextView
23-
android:id="@+id/first_text_view"
24-
android:layout_width="wrap_content"
25-
android:layout_height="wrap_content"
26-
android:editable="false"
27-
/>
28-
<TextView
29-
android:id="@+id/second_text_view"
30-
android:layout_width="wrap_content"
31-
android:layout_height="wrap_content"
32-
android:editable="false"
33-
/>
21+
android:id="@+id/my_scroll_view"
22+
android:layout_width="fill_parent"
23+
android:layout_height="fill_parent">
24+
<LinearLayout
25+
android:orientation="vertical"
26+
android:layout_width="fill_parent"
27+
android:layout_height="fill_parent">
28+
<TextView
29+
android:id="@+id/first_text_view"
30+
android:layout_width="wrap_content"
31+
android:layout_height="wrap_content"
32+
android:editable="false"
33+
/>
34+
<TextView
35+
android:id="@+id/second_text_view"
36+
android:layout_width="wrap_content"
37+
android:layout_height="wrap_content"
38+
android:editable="false"
39+
/>
40+
</LinearLayout>
3441
</ScrollView>
3542

3643
<fragment

tests/Runtime-MultiDex/Mono.Android-TestsMultiDex.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@
7575
<Link>Resources\Drawable\Image.9.png</Link>
7676
</AndroidResource>
7777
</ItemGroup>
78+
<ItemGroup>
79+
<AndroidAsset Include="..\..\src\Mono.Android\Test\Assets\asset1.txt">
80+
<Link>Assets\asset1.txt</Link>
81+
</AndroidAsset>
82+
<AndroidAsset Include="..\..\src\Mono.Android\Test\Assets\subfolder\asset2.txt">
83+
<Link>Assets\subfolder\asset2.txt</Link>
84+
</AndroidAsset>
85+
</ItemGroup>
7886
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
7987
<Import Project="Mono.Android-TestsMultiDex.targets" />
8088
<ItemGroup>

tests/Runtime-MultiDex/Resources/Resource.designer.cs

Lines changed: 71 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Runtime-MultiDex/Resources/layout/Main.axml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,26 @@
1818
android:editable="false"
1919
/>
2020
<ScrollView
21-
android:id="@+id/my_scroll_view">
22-
<TextView
23-
android:id="@+id/first_text_view"
24-
android:layout_width="wrap_content"
25-
android:layout_height="wrap_content"
26-
android:editable="false"
27-
/>
28-
<TextView
29-
android:id="@+id/second_text_view"
30-
android:layout_width="wrap_content"
31-
android:layout_height="wrap_content"
32-
android:editable="false"
33-
/>
21+
android:id="@+id/my_scroll_view"
22+
android:layout_width="fill_parent"
23+
android:layout_height="fill_parent">
24+
<LinearLayout
25+
android:orientation="vertical"
26+
android:layout_width="fill_parent"
27+
android:layout_height="fill_parent">
28+
<TextView
29+
android:id="@+id/first_text_view"
30+
android:layout_width="wrap_content"
31+
android:layout_height="wrap_content"
32+
android:editable="false"
33+
/>
34+
<TextView
35+
android:id="@+id/second_text_view"
36+
android:layout_width="wrap_content"
37+
android:layout_height="wrap_content"
38+
android:editable="false"
39+
/>
40+
</LinearLayout>
3441
</ScrollView>
3542

3643
<fragment

0 commit comments

Comments
 (0)