I have been working in a android project for the first time, so I created a simple GUI for the app however now that I finish I would like to make some changes to the GUI but it is troublesome, if an object is out of place the app does not run and I can not see where is the problem. Is there anyway in eclipse environment check only GUI without load the Java code? I mean, the Java code is ok, problem is the placement of the objects in XML
file, it is taking a lot of time to know. I share the structure of XML
file.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android1="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient"
android:gravity="top"
tools:context=".MainActivity" >
<TextView
android:id="@+id/txtSongName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Song Name"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/albumCover"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_centerInParent="true"
android:layout_margin="30dp"
android:padding="0dp"
android:src="@drawable/music" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/albumCover"
android:background="@drawable/gradient"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<Button
android:id="@+id/btnPrev"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:background="@drawable/back"
android:height="64dp"
android:text="Prev"
android:textSize="0sp"
android:width="16dp" />
<Button
android:id="@+id/btnNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/forward"
android:height="16dp"
android:text="Next"
android:textSize="0sp"
android:width="16dp" />
<Button
android:id="@+id/btnPlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/play"
android:text="Play"
android:textSize="0sp"
android:width="16dp" />
<Button
android:id="@+id/btnStop"
android:layout_width="44dp"
android:layout_height="wrap_content"
android:background="@drawable/stop"
android:text="Stop"
android:textSize="0sp"
android:width="64dp" />
<Button
android:id="@+id/btnReplay"
android:layout_width="49dp"
android:layout_height="46dp"
android:background="@drawable/replay_off"
android:text="Replay"
android:textSize="0sp" />
<Button
android1:id="@+id/btnShuffle"
android1:layout_width="45dp"
android1:layout_height="45dp"
android1:background="@drawable/shuffle_off"
android1:text="Shuffle"
android1:textSize="0sp" />
</LinearLayout>
<SeekBar
android1:id="@+id/seekBar"
android1:layout_width="match_parent"
android1:layout_height="wrap_content"
android1:layout_above="@+id/linearLayout1"
android1:layout_alignParentLeft="true" />
<TextView
android1:id="@+id/songCurrentDuration"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:layout_above="@+id/seekBar"
android1:layout_alignLeft="@+id/albumCover"
android1:text="TextView" />
<TextView
android1:id="@+id/songTotalDuration"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:layout_alignBottom="@+id/albumCover"
android1:layout_alignRight="@+id/albumCover"
android1:text="TextView" />
</RelativeLayout>
Error is that you have use relative layout as the parent layout, and in all its sub layouts you have never declared relative position between the widgets. That is between two text view or button.
Please update accordingly.