I am trying to make the playing cards in my game overlap such that only the first half of a card is seen and the other half is covered by the next playing card. The only card that should be completely visible will be the last/rightmost card.
I have used the following code with both framelayout and relativelayout to no avail. can anyone offer some suggestions?
public int shouldShow(int numberOfCards, int card, int id)
{
if(card == -1)
hide(id);
else
{
findViewById(id).setBackgroundDrawable(deckimages[card]);
//findViewById(id).offsetLeftAndRight(findViewById(id).getWidth()* numberOfCards / 2);
show(id);
//findViewById(id).setPadding(findViewById(id).getWidth()* numberOfCards / 2, 0,0,0);
return numberOfCards+1;
}
return numberOfCards;
}
i have tried using the padding and the offset methods neither of which are working for me. but i have also noticed that the getwidth() and getmeasuredwidth() methods are returning 0.
any suggestions on which layout i should use and why the getwidth functions arent working?
the xml code is below...there would be more images than this but this is what i was testing
<RelativeLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/RelativeLayout1">
<ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
<ImageView android:id="@+id/imageView3" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
</RelativeLayout>