java - Image and Text View errors on Android XML -
i'm making app (in android studio) , weird errors occurring, such large space left before image , text appearing on top of image. have researched no solutions helped.
content.xml:
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview01" android:layout_width="fill_parent" android:layout_height="fill_parent"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity$placeholderfragment"> <imageview android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo" android:layout_centerinparent="true" android:layout_centerhorizontal="true"/> <textview android:id="@+id/section_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/logo" android:text="welcome!" android:textsize="35dp" android:layout_centerinparent="true" android:textcolor="#fff" android:gravity="center_horizontal"/> </relativelayout> </scrollview>
ps< have problem navigation drawer template in android studio, when clicking example action button transparent circle appears squared off on 1 side. :)
i suggest adding components linearlayout
, centering within parent relativelayout
.
example:
<scrollview android:id="@+id/scrollview01" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity$placeholderfragment"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:gravity="center_horizontal" android:orientation="vertical"> <imageview android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo"/> <textview android:id="@+id/section_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="welcome!" android:textcolor="#fff" android:textsize="35dp"/> </linearlayout> </relativelayout> </scrollview>
Comments
Post a Comment