Hello there I am new to programming in general, but have slowly been teaching myself.
I am currently making a very basic program that mainly uses buttons (which all work perfectly).
However Now I want to add a pricelist so I added a button like usual that takes me to the pricelist activity. (normal boring stuff all working fine). I added the pricelist (imageview) onto the page. I use photoshop to change the resolution of the pictures and i set it to 1020*1900 (I have tried making it 900*1800). Everything works perfectly on the emulator and I can see the pricelist but when I switch to my android s4 it does not show the image. The emulator i use is the small nexus default one.
I set the layout height and widths to DP instead cause I heard that might solve the problem (didnt) and I added the contentDescription line (not sure what that does) because android studio was asking me to.
I appreciate all the help I can get! thanks.
Complete Code for the activity. The buttons are just basic buttons that I keep on all my activities in order to take them back to the respective main menus.
?xml version=”1.0″
encoding=”utf-8″?>
RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/btn1"
android:onClick="doSomething"
android:id="@+id/machines"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pl"
android:id="@+id/pl"
android:onClick="doSomething3"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/btn2"
android:id="@+id/spares"
android:onClick="doSomething2"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/machines"
android:layout_toEndOf="@+id/machines"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:layout_gravity="center_horizontal"
android:src="@drawable/pricelist1" />
</LinearLayout>
I decided to add a linearlayout just for completeness, but I have tried it without it and it has made no difference. Perhaps could be something to do with the relativelayout?
2
Answers
I have tested your xml on s4 emulator and its working fine in my emulator. By making just one or two changes.
you can test this xml that I am posting. I have made few changes related to string and image, you can change as per yours.
Note: Image i have used for testing is of size 1020×1900 px.
Try this and let me is it working or not…