I am new in android programming I have problem with horizontalscrollview. I have error \"This HorizontalScrollView layout or its LinearLayout parent is useless\" on
First of all, this is not an error but a warning - the code will still work correctly.
Now, as you can see, you have:
<LinearLayout ...>
<HorizontalScrollView ...>
</HorizontalScrollView ...>
</LinearLayout>
There is only one child in the LinearLayout
- and it's another ViewGroup
- therefore you can get rid of the outer LinearLayout
and simply keep the HorizontalScrollView
:
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="lv.myproject.formula.MainFormula"
tools:ignore="MergeRootFrame"
android:layout_marginTop="50dp" >
...
</HorizontalScrollView>
However if you are adding any Views to the LinearLayout
in your code (i.e. as siblings to your HorizontalScrollView
) then the correct thing is to ignore this warning.