2013-10-30 78 views
1

我是新來的Android.It是我的新。我嘗試了很多修改我的用戶界面,但我cannt.i需要一些幫助來修復我的用戶界面顯示image.my代碼,我做了努力。我希望有人幫我解決我的問題....................................... .........................構建Android用戶界面修改

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:a="http://schemas.android.com/apk/res/android" 
a:layout_width="match_parent" 
a:layout_height="match_parent"> 
<RelativeLayout 
    a:id="@+id/buttonsLayout" 
    a:layout_alignParentBottom="true" 
    a:layout_width="wrap_content" 
    a:layout_height="wrap_content" 
    a:layout_centerInParent="true"> 
    <Button 
     a:text="^" 
     a:id="@+id/up" 
     a:layout_height="wrap_content" 
     a:layout_width="wrap_content" 
     a:layout_alignParentTop="true" 
     a:layout_centerHorizontal="true" /> 
    <Button 
     a:text="&lt;" 
     a:id="@+id/left" 
     a:layout_height="wrap_content" 
     a:layout_width="wrap_content" 
     a:layout_toLeftOf="@+id/center" 
     a:layout_centerVertical="true" /> 
    <Button 
     a:text="0" 
     a:id="@+id/center" 
     a:layout_height="wrap_content" 
     a:layout_width="wrap_content" 
     a:layout_below="@+id/up" 
     a:layout_centerHorizontal="true" 
     a:layout_centerVertical="true" /> 
    <Button 
     a:text="&gt;" 
     a:id="@+id/right" 
     a:layout_height="wrap_content" 
     a:layout_width="wrap_content" 
     a:layout_toRightOf="@+id/center" 
     a:layout_centerVertical="true" /> 
    <Button 
     a:text="v" 
     a:id="@+id/down" 
     a:layout_height="wrap_content" 
     a:layout_width="wrap_content" 
     a:layout_below="@+id/center" 
     a:layout_centerHorizontal="true" /> 
</RelativeLayout> 
<ImageView 
    a:src="@android:drawable/ic_menu_gallery" 
    a:layout_width="match_parent" 
    a:layout_height="match_parent" 
    a:layout_alignParentTop="true" 
    a:layout_above="@+id/buttonsLayout" 
    a:id="@+id/imageView1" /> 
</RelativeLayout> 

我要像我的UI看到鏈接

enter image description here

+0

爲什麼你在整個佈局中寫了'a:'? – GrIsHu

回答

0
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 
    <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:text="192.168.0.500" 
      android:id="@+id/textView" android:layout_weight="1" 
      android:layout_marginLeft="15dp"/> 
    <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Stream" 
      android:id="@+id/button"/> 
</LinearLayout> 
<ImageView 
     android:layout_width="match_parent" 
     android:layout_height="250dp" 
     android:id="@+id/imageView" android:background="@drawable/ic_launcher"/> 
<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 
    <RadioButton 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="New RadioButton1" 
      android:id="@+id/radioButton"/> 
    <RadioButton 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="New RadioButton2" 
      android:id="@+id/radioButton2"/> 
</LinearLayout> 
<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" android:gravity="center"> 
    <Button 
      android:layout_width="100dp" 
      android:layout_height="wrap_content" 
      android:text="Up" 
      android:id="@+id/button2"/> 
</LinearLayout> 
<RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 
    <Button 
      android:layout_width="100dp" 
      android:layout_height="wrap_content" 
      android:text="left" 
      android:id="@+id/button3" 
      android:layout_toLeftOf="@+id/buttonCenter"/> 
    <Button 
      android:layout_width="100dp" 
      android:layout_height="wrap_content" 
      android:text="center" 
      android:id="@+id/buttonCenter" 
      android:layout_centerHorizontal="true"/> 
    <Button 
      android:layout_width="100dp" 
      android:layout_height="wrap_content" 
      android:text="right" 
      android:id="@+id/button5" 
      android:layout_toRightOf="@+id/buttonCenter"/> 
</RelativeLayout> 
<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" android:gravity="center"> 
    <Button 
      android:layout_width="100dp" 
      android:layout_height="wrap_content" 
      android:text="Down" 
      android:id="@+id/button4"/> 
</LinearLayout> 

只需在ImageView中將圖像替換爲您的圖像即可。

+0

非常感謝,它對我來說非常完美。 – user2877786