我第一次在一个android项目中工作,所以我为该应用程序创建了一个简单的GUI,但是现在我完成了,我想对GUI进行一些更改,但是如果一个对象出来了,那就很麻烦了应用程序无法运行的地方,我看不出问题出在哪里。无论如何,在eclipse环境中是否只检查GUI而不加载Java代码?我的意思是,Java 代码没问题,问题是对象在 XML
文件中的放置,需要花费很多时间才能知道。我分享 XML
文件的结构。
<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>
最佳答案
右键单击
Package Explorer
View 中的布局文件之一,然后单击
Open With -> Android Layout Editor
关于java - 在 Eclipse Android 中运行 GUI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34532982/