Reputation: 13
There are some linear layout inside scrollview as well. when i install the app on HUAWEI Mate7 it works just fine. but on Samsung S3 or LG G3 the only thing that shows is background image but when i touch the screen, methods are working. only views are not showing. here is mainActivity.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back1"
android:alpha=".9">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha=".9"
android:gravity="center">
</LinearLayout>
</ScrollView>
</RelativeLayout>
inside the linear layout there are 20 of this
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp" >
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="@+id/imageButton7"
android:src="@drawable/can_pot_com"
android:scaleType="fitStart"
android:background="#00ffffff"
android:cropToPadding="false"
android:foregroundGravity="bottom"
android:layout_weight="2" />
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/can_pot"
android:id="@+id/button6"
android:textStyle="bold"
android:textIsSelectable="false"
android:lines="3"
android:linksClickable="false"
android:textColor="#000000"
android:background="#00ffffff"
android:layout_weight="3" />
</LinearLayout>
I don't know what do to!
Upvotes: 1
Views: 1843
Reputation: 163
I had a similar problem. The LinearLayout inside my ScrollView was not working as expected. The first component of the lineaLayout was not visible. The reason was android:layout_gravity="center_vertical". Change that to android:layout_gravity="top|center_vertical".
Upvotes: 1
Reputation: 2127
try this code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back1"
android:alpha=".9"> <ScrollView
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha=".9"
android:gravity="center">
</LinearLayout>
</ScrollView>
Upvotes: 0
Reputation: 318
The problem is related probably with the align and gravity of the layouts; in the LinearLayout child inside the ScrollView, change the android:gravity="center
by: android:gravity="top|center"
. Hope it helps.
(And and although it does not give you an error, you can remove the second xmlns:android="http://schemas.android.com/apk/res/android")
Upvotes: 1
Reputation: 1354
remove this line from your scrollview
xmlns:android="http://schemas.android.com/apk/res/android"
Upvotes: 0