I'm doing a cards game with 4 players where the backs of the cards of 3 of the players that the phone plays as are present on the screen with part of them outside. I've succeeded in doing this using the margins for the cards views for the top and left players but having a problem with the player on the right where setting the left margin for the card view just resizes it and prevents it from going off screen.
here is a screenshot: Screenshot of the game
I think I'm missing something here...
Thanks!
I think you also need to set the right margin when trying to get it to go off the right side off the screen. For a simple text example, if you have "Here I Am" on the screen, and set the left margin to -30dp, it will go off the screen half way. But if you set the left margin to 275dp, it will re size to stay on the screen unless you also set the right margin to something like 100dp. In order to get a picture to do it without resizing, I had to set the right margin to a negative value.
<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"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="275dp"
android:layout_marginRight="100dp"
android:text="here I am" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:layout_marginLeft="200dp"
android:layout_marginRight="-75dp"
android:src="@drawable/jack" />
</RelativeLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With