Challenge Add Prev Button


#1

[code]

    <Button 
        android:id="@+id/previous_button"
	    android:layout_width="wrap_content"
    	android:layout_height="wrap_content"
        android:text="@string/previous_button"
	    android:drawableRight="@drawable/arrow_left"
    	android:drawablePadding="4dp"/>

	<Button 
        android:id="@+id/next_button"
	    android:layout_width="wrap_content"
    	android:layout_height="wrap_content"
        android:drawableRight="@drawable/arrow_right"
        android:drawablePadding="4dp"
        android:text="@string/next_button" />    	    
    	
    
</LinearLayout>[/code]

I can’t get the arrow icon to appear to the left of the Prev word in the button. Any suggestions?


#2

If you are not seeing the small left arrow to the left of the word “Prev”, what are you seeing?


#3

Did you copy/paste the image files from bignerdranch.com/solutions/A … amming.zip in the 02_MVC/GeoQuiz/res directory into the appropriate corresponding directory of your package explorer? My code in my Activity_Quiz.xml looks the same as yours and my arrow displayed to the left of the word “Prev” as shown in the book.

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
<Button
    android:id="@+id/previous_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/previous_button"
    android:drawableLeft="@drawable/arrow_left"
    android:drawablePadding="4dp" />
<Button 
    android:id="@+id/next_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/next_button"
    android:drawableRight="@drawable/arrow_right"
    android:drawablePadding="4dp" />

#4

It sounds like the issue here is that the “prev” button appears, but the arrow is on the right side. Something like “Prev <-”… where what you want is “<- Prev” is that right? If so, I believe the problem is, you have:

android:drawableRight="@drawable/arrow_left"

Which instructs the application to render the “left” arrow on the rightmost side of the button. Try this:

android:drawableLeft="@drawable/arrow_left"

Does that help?