1

I have been trying to get an XML drawable to be a background on a button but it doesn't render correctly. I've gone up the chain all the way to ImageView and it still doesn't render correctly.

I have the xml drawable code from here: How to create a right facing arrow using xml shapes in android?

Instantiating and setting the background:

 rightArrow = new ImageView(context);
 rightArrow.setImageResource(R.drawable.arrow_right);

Adding the ImageView to the parent view:

 arrowLayout.addView(rightArrow);

But the "arrow" is only partially rendered (as seen here): layout.png

The LinearLayout containing everything has a cyan background to see it better. After the TextView should be an ImageView of the arrow but its not rendered correctly.

EDIT: arrowLayout relavant code:

RelativeLayout arrowLayout;
arrowLayout = new RelativeLayout(context);
arrowLayout.setBackgroundColor(Color.GRAY);

arrowLayout.addView(rightArrow);
layout.addView(arrowLayout);
mjKosmic
  • 63
  • 5

0 Answers0