Rajubhai Rathod
Rajubhai Rathod

Reputation: 113

TextView Issue in ScrollView

I am using textview in scrollview. I am facing issue is that I am getting first line hidden and not able to scroll it for see it. its looking like this

Image of Error

My XML file is like this. Please check and let me know where is I am wrong. Thanks

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
     xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/RelativeLayout1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/background" >

    <LinearLayout
        android:id="@+id/titleBar"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:layout_alignParentTop="true"
        android:background="@drawable/title_bar"
        android:orientation="horizontal" >

        <ImageView
            android:id="@+id/iconImg"
            android:layout_width="70dp"
            android:layout_height="70dp"
            android:layout_gravity="center"
            android:layout_margin="5dip"
            android:background="@drawable/app_icon" />

        <ImageView
            android:id="@+id/titleImg"
            android:layout_width="180dp"
            android:layout_height="60dp"
            android:layout_gravity="center"
            android:layout_margin="5dip"
            android:background="@drawable/title" />

        <RelativeLayout
            android:id="@+id/closeBtn"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:paddingRight="2dip" >

            
        </RelativeLayout>
    </LinearLayout>

    <View
        android:id="@+id/topShadow"
        android:layout_width="fill_parent"
        android:layout_height="5dip"
        android:layout_below="@id/titleBar"
        android:background="@drawable/shadow" >
    </View>

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="6dp"
         android:layout_weight="1"
        android:layout_above="@+id/bottomShadow"
        android:layout_below="@+id/topShadow" >

       <LinearLayout
            android:id="@+id/quote"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:orientation="vertical"
            android:padding="3dp" >

          

            <TextView
                android:id="@+id/text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center"
                android:gravity="center"
                android:text="In order to succeed ..."
                android:lineSpacingMultiplier="1.5" 
                android:textColor="#e8d8a7"
                android:textSize="28sp"
                android:textStyle="bold" />

           <!--  <TextView
                android:id="@+id/author"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:layout_marginRight="10dp"
                android:fontFamily="lucida grande"
                android:text="- Bill Gates"
                android:textColor="#e8d8a7"
                android:textSize="18sp" /> -->
        </LinearLayout>
    </ScrollView>

    <View
        android:id="@+id/bottomShadow"
        android:layout_width="fill_parent"
        android:layout_height="2dip"
        android:layout_above="@+id/buttons"
        android:background="@drawable/shadow" >
    </View>

    <LinearLayout
        android:id="@+id/buttons"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:layout_above="@+id/adView"
        android:layout_alignParentLeft="true"
        android:background="@drawable/title_bar"
        android:orientation="horizontal" >

        <RelativeLayout
            android:id="@+id/PrevioustButtonAction"
            android:layout_width="wrap_content"
            android:layout_height="80dp"
            android:layout_weight="1" >

            <ImageButton
                android:id="@+id/PrevioustButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:layout_marginLeft="4dp"
                android:background="@drawable/prevbotton" />
        </RelativeLayout>

        <View
            android:id="@+id/divider"
            android:layout_width="1dp"
            android:layout_height="match_parent"
            android:layout_below="@+id/titleBar"
            android:background="#000" />

        <RelativeLayout
            android:id="@+id/favorite"
            android:layout_width="wrap_content"
            android:layout_height="80dp"
            android:layout_weight="1" >

            <ImageButton
                android:id="@+id/star"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:layout_marginLeft="4dp"
                android:background="@drawable/star_on" />
        </RelativeLayout>
<View
            android:id="@+id/divider5"
            android:layout_width="1dp"
            android:layout_height="match_parent"
            android:layout_below="@+id/titleBar"
            android:background="#000" />
        <RelativeLayout
            android:id="@+id/copybutton"
            android:layout_width="wrap_content"
            android:layout_height="80dp"
            android:layout_weight="1" >

            <ImageButton
                android:id="@+id/copy"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:layout_marginLeft="4dp"
                android:background="@drawable/copyyy" />
        </RelativeLayout>
        
        <View
            android:id="@+id/divider2"
            android:layout_width="1dp"
            android:layout_height="match_parent"
            android:layout_below="@+id/titleBar"
            android:background="#000" />

        <RelativeLayout
            android:id="@+id/actionItems"
            android:layout_width="wrap_content"
            android:layout_height="80dp"
            android:layout_weight="1" >

            <ImageButton
                android:id="@+id/share"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:layout_marginLeft="4dp"
                android:background="@drawable/share_button" />
        </RelativeLayout>

        <View
            android:id="@+id/divider3"
            android:layout_width="1dp"
            android:layout_height="match_parent"
            android:layout_below="@+id/titleBar"
            android:background="#000" />

        <RelativeLayout
            android:id="@+id/nextButtonAction"
            android:layout_width="wrap_content"
            android:layout_height="80dp"
            android:layout_weight="1" >

            <ImageButton
                android:id="@+id/nextButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:layout_marginRight="4dp"
                android:background="@drawable/nextbotton" />
        </RelativeLayout>
    </LinearLayout>

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_marginTop="10dp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_gravity="center"
        ads:adSize="BANNER"
        ads:adUnitId="@string/admob_publisher_id1"
         />

</RelativeLayout>

Upvotes: 0

Views: 83

Answers (4)

Deep
Deep

Reputation: 89

Try adding some paddingTop or marginTop attribute to your TextView. Or check your layout styles in styles.xml

Upvotes: 1

tiny sunlight
tiny sunlight

Reputation: 6251

Plz check you theme for this activity in styles.xml

Find <item name="android:windowContentOverlay">true</item> and change it to <item name="android:windowContentOverlay">@null</item>

Upvotes: 1

Shree Krishna
Shree Krishna

Reputation: 8562

It is hard to find out your actual problem because you are providing layout different from your actual layout shown in error image. But my suggestion is Try adding some paddingTop or marginTop attribute to your TextView which contains Text "Test 1".

Upvotes: 0

akhil Rao
akhil Rao

Reputation: 1169

try setting android:paddingTop="some value" for the textview

Upvotes: 0

Related Questions