Skip to content

Commit

Permalink
[tests] Fix Layout so the test app actually runs (dotnet#2720)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dellis1972 authored and jonpryor committed Feb 11, 2019
1 parent d7ce336 commit 650b409
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 97 deletions.
33 changes: 20 additions & 13 deletions src/Mono.Android/Test/Resources/layout/Main.axml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,26 @@
android:editable="false"
/>
<ScrollView
android:id="@+id/my_scroll_view">
<TextView
android:id="@+id/first_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false"
/>
<TextView
android:id="@+id/second_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false"
/>
android:id="@+id/my_scroll_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/first_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false"
/>
<TextView
android:id="@+id/second_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false"
/>
</LinearLayout>
</ScrollView>

<fragment
Expand Down
8 changes: 8 additions & 0 deletions tests/Runtime-MultiDex/Mono.Android-TestsMultiDex.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@
<Link>Resources\Drawable\Image.9.png</Link>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidAsset Include="..\..\src\Mono.Android\Test\Assets\asset1.txt">
<Link>Assets\asset1.txt</Link>
</AndroidAsset>
<AndroidAsset Include="..\..\src\Mono.Android\Test\Assets\subfolder\asset2.txt">
<Link>Assets\subfolder\asset2.txt</Link>
</AndroidAsset>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="Mono.Android-TestsMultiDex.targets" />
<ItemGroup>
Expand Down
142 changes: 71 additions & 71 deletions tests/Runtime-MultiDex/Resources/Resource.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 20 additions & 13 deletions tests/Runtime-MultiDex/Resources/layout/Main.axml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,26 @@
android:editable="false"
/>
<ScrollView
android:id="@+id/my_scroll_view">
<TextView
android:id="@+id/first_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false"
/>
<TextView
android:id="@+id/second_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false"
/>
android:id="@+id/my_scroll_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/first_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false"
/>
<TextView
android:id="@+id/second_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false"
/>
</LinearLayout>
</ScrollView>

<fragment
Expand Down

0 comments on commit 650b409

Please sign in to comment.