2012-06-20 4 views
0

을 구축 할 때 나는 XML 파일 presentation_main.xml 만들 :R는 해결되지 않을 수 있습니다 ... XML 코드

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 
    <LinearLayout 
     android:id="@+id/top" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true"   
     android:orientation="horizontal" 
     > 

     <TextView 
      android:text="..." 
      android:id="@+id/txtDate" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      /> 
    </LinearLayout> 
    <LinearLayout 
     android:layout_below="@id/top" 
     android:layout_above="@id/bottom"      
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_alignParentLeft="true" 
     android:orientation="vertical"   
     > 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/img1" 
      android:contentDescription="@string/shop" 
      android:src="@drawable/ic_launcher" 
      /> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/img2" 
      android:contentDescription="@string/shop" 
      android:src="@drawable/ic_launcher" 
      /> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/img3" 
      android:contentDescription="@string/shop" 
      android:src="@drawable/ic_launcher"      
      /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_below="@id/top" 
     android:layout_above="@id/bottom" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_centerHorizontal="true" 
     android:orientation="vertical"   
     > 
     <ImageView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:id="@+id/img4" 
      android:contentDescription="@string/shop" 
      android:src="@drawable/preloaderf1" 
      /> 
    </LinearLayout> 
    <LinearLayout 
     android:layout_below="@id/top" 
     android:layout_above="@id/bottom" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_alignParentRight="true" 
     android:orientation="vertical" 
     > 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/img5" 
      android:contentDescription="@string/shop" 
      android:src="@drawable/ic_launcher" 
      /> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/img6" 
      android:contentDescription="@string/shop" 
      android:src="@drawable/ic_launcher" 
      /> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/img7" 
      android:contentDescription="@string/shop" 
      android:src="@drawable/ic_launcher" 
      /> 
    </LinearLayout> 
    <LinearLayout 
      android:id="@+id/bottom" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_marginBottom="20dp" 
     > 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/level" 
      android:layout_marginLeft="15dp" 
      android:layout_marginRight="10dp" 
      android:textSize="25dp" 
      /> 

     <ProgressBar 
      android:id="@+id/proBar" 
      style="@android:style/Widget.ProgressBar.Horizontal" 
      android:layout_width="fill_parent" 
      android:layout_height="30dp" 
      android:layout_marginRight="15dp" 
      android:progress="50"   
      android:max="100" 
      /> 

    </LinearLayout> 
</RelativeLayout> 

오류가 무엇입니까? 내가 지었다 >>> R은 해결할 수 없다? 다음과 같이

레이아웃 디자인은

enter image description here

XML 파일 ID 오류입니까?

+0

코드를 붙여 넣기 위해 pastebin을 사용하십시오. 이러한 목적으로 미디어 파이어를 사용하지 마십시오. –

+1

StackOverflow에 게시 할 때 StackOverflow에 게시하고 붙여 넣기는하지 않습니다. 또한 안드로이드 패키지에서 R을 가져올 수 없습니다. 이 오류 자체입니다. –

+0

eclipse를 사용하는 경우 res 폴더를 확장하고 리소스 오류를 찾기 위해 빨간색 느낌표를 찾으십시오. 아무 것도 남지 않을 때까지 수정, 헹굼, 반복하십시오. 어떤 클린 빌드가없는 경우 – Idistic

답변

2

프로젝트 -> 클린을 시도 했습니까?

1

다른 상단 레이아웃의 ID @id/bottom을 신고하기 전에 android:layout_above="@id/bottom"으로 지정했기 때문일 수 있습니다. 선언되기 전에 id를 참조하려고하지 마십시오.

http://developer.android.com/guide/topics/ui/layout-objects.html#relativelayout

그냥 @+id/top와 선형 레이아웃 아래 @id/bottom와 선형 레이아웃을 선언하고이 문제를 해결해야이 문제에 대한 더 많은 빛을주는이 링크를 확인하십시오.

0

id의 첫 번째 출현은 위젯이거나 위젯에 대한 참조이든 "+"가 있어야하는 것입니다.

<LinearLayout 
    android:layout_below="@id/top" 
    android:layout_above="@+id/bottom" 
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent" 
    android:layout_alignParentLeft="true" 
    android:orientation="vertical" > 

위의 내용은 완전히 유효합니다. "하단"위젯에 도달하면 여기에 @id/bottom을 사용합니다.

0

드로어 블 폴더에 대문자 또는 잘못된 형식의 이미지가 있는지 확인하십시오. R.java 파일이 풀립니다.

오류가있는 위치를 찾을 수없는 경우 Eclipse를 다시 시작하고 콘솔을 확인하십시오. 오류가있는 위치를 보여줍니다.

관련 문제