2012-06-15 1 views
0

RelativeLayout을 실행하여 사용자 지정 목록 에 사용할 수 있도록 노력하고 있지만 항목을 서로 비교하여 공간을 확보하려고 할 때 나사가 위로 올라가고 말합니다.xml의 ID를 확인할 수 없다

자원 @ ID를 확인할 수 없습니다/itemName에
는 확인할 수 없습니다 자원 @ 아이디/textPriceFrom

textPriceFrom 장소 올바르게 자체하지만, 가격이되지 않기 때문에이 이상한 것입니다.

<RelativeLayout 
     android:id="@+id/mainlayout" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" > 

    <TextView 
     android:id="@+id/itemName" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="3dip" 
     android:text="A good day" 
     android:textSize="23dip" 
     android:textStyle="bold" /> 

    <TextView 
     android:id="@+id/textPriceFrom" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/itemName" 
     android:layout_margin="3dip" 
     android:text="@string/frapris" 
     android:textSize="15dip" 
     android:textStyle="normal" /> 

    <TextView 
     android:id="@+id/textPrice" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="3dip" 
     android:layout_toLeftOf="@id/textPriceFrom" 
     android:text="145,95" 
     android:textSize="10dip" 
     android:textStyle="normal" /> 

    <ImageView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_centerVertical="true" 
     android:layout_margin="3dip" 
     android:src="@drawable/ic_launcher" /> 
</RelativeLayout> 

답변

1

android:layout_width="fill_parent"은 분명히 그 오류를 만들었던 왼쪽/오른쪽 꺼짐을위한 공간을 만들지 않았습니다.

+0

와우 - 나는 왼쪽/오른쪽보기를 볼 수 없도록 만들었을 뿐이며 오류가 발생하지 않을 것이라고 생각했을 것입니다. – barry

+0

나도 그것을 변경했는데, 그것을 변경했을 때 문제없이 작동했습니다 :-) –

0

시도가 @+id/textPriceFrom 대신 @id/textPriceFrom 사용하기 : 여기

는 코드입니다.

정말 죄송합니다. 이유를 설명하지 못했습니다. 그러나 이것이 나를 위해 어떻게 작동하는지입니다.

+3

기존 ID를 참조하지 않고 새 ID를 만들 때만 +를 추가한다고 생각합니다. – barry

+0

왜 대답을 게시하지 않을지 모르겠다. tbh ;-) 시도해 보시고 C/P로 시도해보고 UR 기계에서 작동하는지 확인해 주시겠습니까? –