Android app blank but not in Designer? - java

I am making an alarm app but i wanted to change it to be a reminder and basically you type in the reminder and when the alarm goes off you can click to do text to speech on the reminder you saved. However, between testing and adding the text to speech my android app no longer shows any objects when running in the emulator but when designing i can see them all. I have tried to copy all the code into a new project but it does the same.
Here's the image of the emulator and designer.
It doesn't say but its a Relative Layout
There is the files of the project.
http://www.mediafire.com/file/uhybhd5sygu2714/AlarmFix.zip

First dont combine Contraintlayout attributes (such as : app:layout_constraintBottom_toBottomOf) it will not works with Relative/LinearLayout, just you need to use attributes such as android:layout_below... RelativeLayout.LayoutParams
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:id="#+id/tvUpdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:layout_below="#+id/linearalarm" />
<EditText
android:id="#+id/etReminder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:ems="10"
android:hint="Your Reminder"
android:inputType="textPersonName"
android:textAlignment="center" />
<TimePicker
android:id="#+id/timePicker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/etReminder" />
<LinearLayout
android:id="#+id/linearalarm"
android:layout_below="#id/timePicker"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/alarm_on"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ALARM ON" />
<Button
android:id="#+id/alarm_off"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ALARM OFF" />
<Button
android:id="#+id/btnPlayRem"
android:layout_weight="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PLAY LATEST REMINDER" />
</LinearLayout></RelativeLayout>

Related

Android Studio components not centering correctly when tested on an external device

I have a simple app written in Java that I am trying to make work on Android devices. The code runs without issue, but the layout of the widgets is inconsistent.
I want all of them to be centered on the screen, and this works when I run the program in an emulator from Android Studio- I have tried this with an emulated Nexus 6P and a Pixel 3A.
However, when I run the program on a physical device, a Galaxy S9, some of the widgets are no longer centered.
I have tried centering the gravity for the RelativeLayout, and using android:layout_centerHorizontal="true" for each of the widgets. I also tried setting the size of the widgets to match_parent and then centering the gravity horizontally inside them. So far this has all given the same result.
I include the XML code below, along with two screenshots for comparison, one from the emulated Nexus 6P and one from the Galaxy S9. You should see that the button and the number field are centered, but all of the text is slightly off-centre.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<TextView
android:id="#+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="25dp"
android:editable="false"
android:gravity="center_horizontal"
android:text="Arby's Hi-Lo Guessing Game"
android:textAppearance="#style/TextAppearance.AppCompat.Large"
android:visibility="visible" />
<TextView
android:id="#+id/txtPrompt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="-2dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="75dp"
android:gravity="center|center_horizontal"
android:text="Enter a number between 1 and 100:"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:layout_alignParentLeft="true" />
<EditText
android:id="#+id/txtGuess"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="105dp"
android:layout_marginEnd="166dp"
android:layout_marginRight="166dp"
android:ems="10"
android:gravity="center_horizontal"
android:inputType="number" />
<Button
android:id="#+id/btnGuess"
android:layout_width="126dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:layout_marginTop="175dp"
android:text="Guess!" />
<TextView
android:id="#+id/lblOutput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="250dp"
android:gravity="center_horizontal"
android:text="Enter a number, then click Guess!"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textSize="18sp" />
</RelativeLayout>
Emulator Alignment
Physical Device Alignment
Your views have absolute margins set in dp. These will not look the same on different sized screens. Remove all marginStart, marginEnd, marginRight and marginLeft attributes. Then RelativeLayout should center the views properly.
try this, i did it fast but i hope it wiill work ;)
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/txtTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:textAlignment="center"
android:layout_marginTop="25dp"
android:editable="false"
android:text="Arby's Hi-Lo Guessing Game"
android:textAppearance="#style/TextAppearance.AppCompat.Large"
android:visibility="visible"
/>
<TextView
android:id="#+id/txtPrompt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="#+id/txtTitle"
android:textAlignment="center"
android:layout_marginTop="25dp"
android:text="Enter a number between 1 and 100:"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
/>
<EditText
android:id="#+id/txtGuess"
android:layout_width="75dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="#+id/txtPrompt"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:inputType="number" />
<Button
android:id="#+id/btnGuess"
app:layout_constraintTop_toBottomOf="#+id/txtGuess"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="30dp"
android:layout_width="126dp"
android:layout_height="wrap_content"
android:text="Guess!" />
<TextView
android:id="#+id/lblOutput"
app:layout_constraintTop_toBottomOf="#+id/btnGuess"
android:textAlignment="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="Enter a number, then click Guess!"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textSize="18sp" />
</android.support.constraint.ConstraintLayout>

How can I fix the alignment issue in my android application

I have created a login page with :
1 small image,
2 text boxes,
1 button
but I want them to align in all types of devices like when I tried on my device and it looks fine but not for the other devices that are bigger-smaller in screen-sizes
Thanks in advance
Here is the code :
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hardwareAccelerated="true"
android:background="#color/white"
tools:context=".MainActivity">
<View
android:id="#+id/view2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:hardwareAccelerated="true" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="37dp"
android:background="#color/blend"
android:contentDescription="#string/todo"
app:srcCompat="#drawable/imagelogo" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="58dp"
android:layout_marginBottom="294dp"
android:ems="10"
android:hint="#string/User_name"
android:inputType="text" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginEnd="147dp"
android:layout_marginBottom="227dp"
android:ems="10"
android:hint="#string/Pass_word"
android:inputType="textPassword" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="97dp"
android:layout_marginBottom="138dp"
android:ems="13"
android:background="#color/colorPrimary"
android:text="#string/login" />
and the output :
Design + Blueprint
So i want all my things at same place in every type of devices
Add below into your project level Gradle file:
compile 'com.intuit.sdp:sdp-android:1.0.5'
Usage : In code wherever you are specifying dimensions like 10dp change it to #dimen/_10sdp. Like I have specified in this example ImageView.
<ImageView
android:id="#+id/your_image"
android:layout_marginTop="#dimen/_10sdp"
android:layout_marginBottom="#dimen/_10sdp"
android:layout_width="#dimen/_100sdp"
android:layout_height="#dimen/_100sdp"
android:src="#drawable/logo"/>
This will make your application look same on different devices.

How to resize the layout properly? - Android

Im trying to make an app for the sony smart watch 2.
Im trying to make a basic converter app which consists of one text box, two radio buttons and one button. Yet when testing on the watch everything is massive. If I resize things in eclipse things disappear and other things what is happening? Picture of it on watch:http://content.screencast.com/users/jeremyc12/folders/Jing/media/050d6158-1daa-4ebe-8eb2-ed8a46e3d024/2014-04-23_1334.png
Here is my xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="#dimen/smart_watch_2_control_width"
android:layout_height="#dimen/smart_watch_2_control_height"
android:background="#color/myColor"
android:onClick="calculate"
tools:ignore="PxUsage" >
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:inputType="numberSigned"
android:width="5px" >
<requestFocus />
</EditText>
<RadioButton
android:id="#+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText1"
android:layout_alignBottom="#+id/editText1"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:checked="true"
android:text="#string/kmh" />
<RadioButton
android:id="#+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/button2"
android:layout_alignLeft="#+id/radioButton1"
android:text="#string/miles" />
<Button
android:id="#+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/editText1"
android:text="#string/calc" />
Two issues I see here:
As Aritra pointed out, make sure in your XML layout that you aren't doing any scaling. So don't use "dp" just "px".
There are only a few Views in Android supported on SW2. See here for details:
http://developer.sonymobile.com/reference/sony-addon-sdk/com/sonyericsson/extras/liveware/aef/control/Control.Intents#EXTRA_DATA_XML_LAYOUT
EditText, RadioButton and Button views are not included there so thats why you're seeing some strange issues even without scaling.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff0000"
android:onClick="calculate" >
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:inputType="numberSigned"
android:width="5px" >
<requestFocus />
</EditText>
<RadioButton
android:id="#+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText1"
android:layout_toRightOf="#+id/radioButton2"
android:checked="true"
android:text="kmh"
android:textSize="8sp" />
<RadioButton
android:id="#+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText1"
android:text="miles"
android:textSize="8sp"/>
<Button
android:id="#+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/radioButton2"
android:layout_toRightOf="#+id/editText1"
android:text="calculate"
android:textSize="8sp"/>
</RelativeLayout>

"Include Other Layout" causes build to fail in emulator. No errors or associated warnings

I've added a couple small relative layouts to the main layout of an activity using "Include Other Layout" in the graphical editor. However, for some reason when I try to load the activity in the emulator, it fails. There are no warnings other than a bunch of generic stuff in LogCat that looks exactly the same as any other time I have an error. In the .Java file for this activity, I've successfully made reference to the views within these included layouts without any problems.
This are the elements from the activity's .xml file that include the layouts.
<include
android:id="#+id/include1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/lblParklandAssistDesc"
android:layout_below="#+id/lblParklandAssistDesc"
layout="#layout/parklandweight" />
<include
android:id="#+id/include2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/include1"
android:layout_below="#+id/include1"
layout="#layout/parklandbsa" />
And these are the layouts that are included
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="#+id/btnWeightUp"
style="?android:attr/buttonStyleSmall"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="#string/Up" />
<Button
android:id="#+id/brnWeightDown"
style="?android:attr/buttonStyleSmall"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/btnWeightUp"
android:text="#string/Down" />
<TextView
android:id="#+id/lblParklandWeightTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/btnWeightUp"
android:text="#string/lblWeight"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/txtWeight"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_below="#+id/lblParklandWeightTitle"
android:layout_toRightOf="#+id/btnWeightUp"
android:ems="10"
android:inputType="number"
android:text="100" >
<requestFocus />
</EditText>
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/lblParklandWeightTitle" >
<RadioButton
android:id="#+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="#string/lb" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/kg" />
</RadioGroup>
</RelativeLayout>
Then the other one.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="#+id/btnBSADown"
style="?android:attr/buttonStyleSmall"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/btnBSAUp"
android:layout_below="#+id/btnBSAUp"
android:text="#string/Down" />
<TextView
android:id="#+id/lblParklandBSAtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="58dp"
android:text="#string/lblParklandBSAtitle"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="#+id/btnBSAUp"
style="?android:attr/buttonStyleSmall"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="#string/Up" />
<EditText
android:id="#+id/txtBSA"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/lblParklandBSAtitle"
android:layout_below="#+id/lblParklandBSAtitle"
android:ems="10"
android:inputType="number"
android:text="3" />
</RelativeLayout>
I don't have the foggiest idea as to what could be going on or frankly even where to look. I've been working with eclipse and java with android for almost two weeks, have made one app, and have been having great luck and easy learning with everything. This has left me stumped. Any help would be greatly appreciated!
New Addition(added .Java Content because it seems that the xml layouts themselves may not be the problem):
In the top of the activity's class I declare the variables that will handle the other layouts like this:
View parklandWeight;
View parklandBSA;
Then, when I assign the object to it - I do so like this:
parklandWeight = (View) findViewById(R.layout.parklandweight);
parklandBSA = (View) findViewById(R.layout.parklandbsa);
The only error that appears to be from this activity.java in the LogCat occurs just after this second assignment. On another assignment that refers a button inside one of these layouts:
btnWeightUp = (Button) parklandWeight.findViewById(R.id.btnWeightUp);
Could this be the root of my issue? I've read at least five or six different threads here in StackOverflow where this is what is advised to do. Thanks in advance.
I have tried these code runs perfect... Try these.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:ignore="HardCodedText" >
<include
android:id="#+id/include2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/include1"
android:layout_alignParentTop="true"
android:layout_below="#+id/include1"
layout="#layout/top" />
<Button
android:id="#+id/btnWeightUp"
style="?android:attr/buttonStyleSmall"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/include2"
android:text="Up" />
<Button
android:id="#+id/brnWeightDown"
style="?android:attr/buttonStyleSmall"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_below="#+id/btnWeightUp"
android:text="Down" />
<TextView
android:id="#+id/lblParklandWeightTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/include2"
android:layout_toRightOf="#+id/btnWeightUp"
android:text="lblWeight"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/txtWeight"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_below="#+id/lblParklandWeightTitle"
android:layout_toRightOf="#+id/btnWeightUp"
android:ems="10"
android:inputType="number"
android:text="100" >
<requestFocus />
</EditText>
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/include2"
android:layout_toRightOf="#+id/lblParklandWeightTitle" >
<RadioButton
android:id="#+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="lb" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="kg" />
</RadioGroup>
</RelativeLayout>
I was typing the variables for the layouts wrong. Instead of using
View layoutVariable;
I needed to be typing by the actual layout type as below.
RelativeLayout parklandWeight;
RelativeLayout parklandBSA;
Then, when assigning the actual layout object to the variable, I should have been typing it as the layout type, of course. But, more than that, in the findViewById method I was using R.layout.layout_id when I should have been using R.id.layout_id. I was also referring to the xml file name where I should have been referring to the same +id that is used in the include tag in the xml file.
This is the way I should have been doing it:
parklandWeight = (RelativeLayout) findViewById(R.id.include1);
parklandBSA = (RelativeLayout) findViewById(R.id.include2);
I hope this helps any newcomers to android development who run into the same problem. I hope you all have an incredible day!

Android XML Issue - images not displaying in AVD

I'm fairly new to android but I've managed to figure out how all the layout stuff works with XML. That's all fine.
In the Graphical Layout tab in Eclipse I have a few buttons and a logo which is a .gif image. I have place the .gif image into my XML file as an ImageView within a LinearLayout and it shows up on the Graphical Layout.
But when I run it in the Android Virtual Device (AVD) everything shows up but the image. Anyone know why this is happening? See XML code below...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/natlib"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:padding="#dimen/padding_medium"
android:text="#string/welsh_libs"
android:textColor="#79438F"
android:textSize="22dip"
android:textStyle="bold"
tools:context=".MainActivity" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="#+id/button1"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#A4C81C"
android:text="#string/ask_lib" />
<Button
android:id="#+id/button2"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#FF0066"
android:text="#string/find_book" />
<Button
android:id="#+id/button3"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#3F83F1"
android:text="#string/find_lib" />
<Button
android:id="#+id/button4"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#FE0002"
android:text="#string/register" />
<Button
android:id="#+id/button5"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="#FBFC3F"
android:text="#string/login" />
<ImageView
android:id="#+id/image1"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_marginLeft="220dp"
android:layout_marginTop="20dp"
android:layout_weight="0.37"
android:contentDescription="#string/desc"
android:src="#drawable/wag_logo"
android:visibility="visible" />
</LinearLayout>
set android:layout_height greater than 0...try this
<ImageView
android:id="#+id/image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="220dp"
android:layout_marginTop="20dp"
android:layout_weight="0.37"
android:contentDescription="#string/desc"
android:src="#drawable/wag_logo"
android:visibility="visible" />
Which folder did you place the image in? /res/drawable?
Also, which folder did you place the layout in? /res/layout?
The /res/ folder and it's subfolders are used in Localization.
So if you only have it in /res/drawable-xhdpi/, it'll only show up on very large devices.
Also, if you modified your layout file at /res/layout-large/ and didn't modify the one at /res/layout, only the large version would get the modifications.

Categories