2017-02-03 2 views
0

누구나 나를 도울 수 있는지 궁금해합니다. 기능을 새로 고치기 위해 스 와이프를 추가하려고합니다. 잘못된 위치를 볼 수 없으며, 오류 메시지가 기호를 해결할 수 없습니다. mySwipeRefreshLayoutAndroid Studio 스 와이프 새로 고침

코드를 수정하십시오. 감사합니다

public class eventsListActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener { 

mySwipeRefreshLayout.setOnRefreshListener(
     new SwipeRefreshLayout.OnRefreshListener() { 
    @Override 
    public void onRefresh() { 

     refreshList(); 
    } 
} 

public class eventsListActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener { 

mySwipeRefreshLayout.setOnRefreshListener(
     new SwipeRefreshLayout.OnRefreshListener() { 
    @Override 
    public void onRefresh() { 

     refreshList(); 
    } 
} 

XML 코드 :

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_events_list" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.parse.fypPlannr.eventsListActivity" 
    android:background="#24B14D"> 

<android.support.v4.widget.SwipeRefreshLayout 
    android:id="@+id/Swiper" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
<ListView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_centerHorizontal="true" 
    android:id="@+id/eventList" 
    android:layout_below="@+id/createEvent" 
    android:textColor="@android:color/holo_orange_light"/> 
</android.support.v4.widget.SwipeRefreshLayout> 
<Button 
    android:text="Map View" 
    android:layout_height="wrap_content" 
    android:id="@+id/mapButton" 
    android:layout_width="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" 
    android:background="#029789" 
    android:textColor="#ffffbb33" 
    android:onClick="mapView" /> 

<Button 
    android:text="Log Out" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/logOut" 
    android:onClick="logOut" 
    android:background="#029789" 
    android:textColor="#ffffbb33" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:layout_toLeftOf="@+id/mapButton" 
    android:layout_toStartOf="@+id/mapButton" /> 

<Button 
    android:text="Create Event" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/createEvent" 
    android:onClick="createEvent" 
    android:background="#04988a" 
    android:textColor="#ffffbb33" 
    android:layout_alignParentTop="true" 
    android:layout_toRightOf="@+id/mapButton" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentEnd="true" /> 

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_events_list" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.parse.fypPlannr.eventsListActivity" 
    android:background="#24B14D"> 

<android.support.v4.widget.SwipeRefreshLayout 
    android:id="@+id/Swiper" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
<ListView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_centerHorizontal="true" 
    android:id="@+id/eventList" 
    android:layout_below="@+id/createEvent" 
    android:textColor="@android:color/holo_orange_light"/> 
</android.support.v4.widget.SwipeRefreshLayout> 
<Button 
    android:text="Map View" 
    android:layout_height="wrap_content" 
    android:id="@+id/mapButton" 
    android:layout_width="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" 
    android:background="#029789" 
    android:textColor="#ffffbb33" 
    android:onClick="mapView" /> 

<Button 
    android:text="Log Out" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/logOut" 
    android:onClick="logOut" 
    android:background="#029789" 
    android:textColor="#ffffbb33" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:layout_toLeftOf="@+id/mapButton" 
    android:layout_toStartOf="@+id/mapButton" /> 

<Button 
    android:text="Create Event" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/createEvent" 
    android:onClick="createEvent" 
    android:background="#04988a" 
    android:textColor="#ffffbb33" 
    android:layout_alignParentTop="true" 
    android:layout_toRightOf="@+id/mapButton" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentEnd="true" /> 

http://pastebin.com/u72WtQ3y 자바 코드

,832 10 Xml

+1

잠시 동안 내 게시물을 편집했습니다. 그리고 게시물에 코드를 게시했습니다. 코드에 대한 더 나은 설명을 넣고 logcat을 게시하고 stackoverflow 외부의 일부 webiste를 가리키는 링크를 제거 할 수 있는지 확인하십시오. – Yupi

+0

변수를 사용하기 전에 Java로 선언해야합니다. 귀하의'mySwipeRefreshLayout'은 현재 클래스 또는 수퍼 클래스에서 선언되지 않았습니다. Android를 시도하기 전에 [Java Tutorials] (https://docs.oracle.com/javase/tutorial/)에서 약간의 시간을 보내십시오. 그렇지 않으면 지금부터 어디서나 어려운 문제가 발생할 것입니다. –

답변

0

구현 도구를 사용할 필요가 없습니다. SwipeRefreshLayout.OnRefreshListener.

그리고 다른 문제를 찾지 못했습니다. 어쩌면 refreshList()에 잘못이 있습니다. 방법

관련 문제