마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

TextView를 왜 ImageView로 찾는지 모르겠습니다

0 추천

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id = "@+id/chat_room_root_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:layout_marginTop="15dp"
        android:text="TextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/chat_room_text_time"
        android:layout_alignParentTop="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />

    <TextView
        android:text="TextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/text_chat_room_phonenum"
        android:layout_marginLeft="18dp"
        android:layout_marginStart="18dp"
        android:layout_alignBaseline="@+id/chat_room_text_time"
        android:layout_alignBottom="@+id/chat_room_text_time"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:text="TextView"
        android:id="@+id/chat_room_text_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/text_chat_room_phonenum"
        android:layout_alignLeft="@+id/text_chat_room_phonenum"
        android:layout_alignStart="@+id/text_chat_room_phonenum"
        android:layout_marginTop="16dp"
        />

    <TextView
        android:text="TextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/chat_room_text_name"
        android:layout_alignBaseline="@+id/text_chat_room_phonenum"
        android:layout_alignBottom="@+id/text_chat_room_phonenum"
        android:layout_toRightOf="@+id/text_chat_room_phonenum"
        android:layout_toEndOf="@+id/text_chat_room_phonenum" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="2dp"
        app:srcCompat="@android:color/darker_gray"
        android:layout_below="@+id/image_chatting_room_new"
        android:id="@+id/imageView4"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />

    <ImageView
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:id="@+id/image_chatting_room_new"
        app:srcCompat="@drawable/dummy_image"
        android:layout_alignTop="@+id/chat_room_text_date"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />

</RelativeLayout>

 

이렇게 있습니다 

 

어뎁터

    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_chatting_room, parent, false);
    return new ChatRoomViewHolder(view);

뷰홀더
    private TextView phoneNum, date, time, name;
    private ImageView notiImage;
    public ChatRoomViewHolder(View view){
        super(view);
        this.view = view;
        view.setOnClickListener(this);
        phoneNum = (TextView)view.findViewById(R.id.text_chat_room_phonenum);
        date = (TextView)view.findViewById(R.id.chat_room_text_date);
        time = (TextView)view.findViewById(R.id.chat_room_text_time);
        name = (TextView)view.findViewById(R.id.chat_room_text_name);
        notiImage = (ImageView)view.findViewById(R.id.image_chatting_room_new);
    }

에러

Relative레이아웃에서 뭔가 하는거같은데 왜인지 질문 드립니다.

익명사용자 님이 2016년 11월 23일 질문
clean 빌드 해 보세요. 기존 빌드한 이후 중간에 레이아웃 삽입하면 리소스 아이디가 꼬여 엉뚱한데 가리켜서 오류 날 수 있습니다.
감사합니다 해결 됬습니다

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...