UPDATE: I've opened a new thread with my updated question here: Android - How to display 4 text views with Icons? Thank you for your answers, I'd really appreciate it if you could help me with my newer thread above.
I'm trying to display 4 text views at the bottom of the screen but I can't figure out how to that that. Every time I try to move one button it screws up the rest.
Here's what it currently looks like:
Here's my manuel marks as to where I want to position the buttons (Each line represents a text view item position):
Here's the current code, any pointers would be really great:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:context=".MainActivity" >
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true" >
</android.support.v4.view.ViewPager>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="124dp"
android:layout_toRightOf="@+id/ButtonRate"
android:text="TextView" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView1"
android:layout_alignBottom="@+id/textView1"
android:layout_alignRight="@+id/ButtonWallpaper"
android:text="TextView" />
<TextView
android:id="@+id/ButtonWallpaper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/textView2"
android:layout_marginRight="50dp"
android:layout_marginTop="137dp"
android:clickable="true"
android:onClick="setWallpaper"
android:text="@string/set_wallpaper"
android:textColor="@color/red" />
<TextView
android:id="@+id/ButtonRate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/ButtonWallpaper"
android:layout_alignBottom="@+id/ButtonWallpaper"
android:layout_alignParentLeft="true"
android:layout_marginLeft="50dp"
android:clickable="true"
android:onClick="rate"
android:text="@string/rate_button"
android:textColor="@color/red" />
I'm really stuck.
Thanks very much in advance, Dvir
You need to put another relative layout after ViewPager
for your textViews, and add android:layout_alignParentBottom="true"
to that Layout
like this:
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true" >
</android.support.v4.view.ViewPager>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/ButtonRate"
android:text="TextView" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView1"
android:layout_alignBottom="@+id/textView1"
android:layout_alignRight="@+id/ButtonWallpaper"
android:text="TextView" />
<TextView
android:id="@+id/ButtonWallpaper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/textView2"
android:layout_marginRight="50dp"
android:clickable="true"
android:onClick="setWallpaper"
android:text="hello" />
<TextView
android:id="@+id/ButtonRate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/ButtonWallpaper"
android:layout_alignBottom="@+id/ButtonWallpaper"
android:layout_alignParentLeft="true"
android:layout_marginLeft="50dp"
android:clickable="true"
android:onClick="rate"
android:text="hello2" />
</RelativeLayout>
Also note that I've deleted android:layout_marginTop
parameters, you can adjust it, if you wish