2016-10-17 101 views
0

我想要使用android annotation.First所有在@Click中声明的方法没有被突出显示,虽然我在XML中声明。早在它被突出显示它现在不是。当它被highlted然后还敬酒功能没有work..Pls帮我@Click不工作android注释

 <LinearLayout 
     android:id="@+id/lLayout" 
     android:clickable="true" 
     android:onClick="openProfile" 
     android:layout_width="match_parent" 
     android:layout_height="75dp" 
     android:orientation="vertical" 
     android:layout_gravity="bottom" 
     android:gravity="center|left" 
     android:paddingLeft="20dp"> 

的Java

package com.rsdc.tinder; 

import android.annotation.TargetApi; 
import android.app.Activity; 
import android.content.Context; 
import android.content.DialogInterface; 
import android.content.Intent; 
import android.os.Build; 
import android.os.Bundle; 
import android.support.annotation.UiThread; 
import android.util.Log; 
import android.widget.ImageView; 
import android.widget.LinearLayout; 
import android.widget.TextView; 
import android.widget.Toast; 

import com.bumptech.glide.Glide; 
import com.mindorks.placeholderview.SwipePlaceHolderView; 
import com.mindorks.placeholderview.annotations.Click; 
import com.mindorks.placeholderview.annotations.Layout; 
import com.mindorks.placeholderview.annotations.Resolve; 
import com.mindorks.placeholderview.annotations.View; 
import com.mindorks.placeholderview.annotations.swipe.SwipeCancelState; 
import com.mindorks.placeholderview.annotations.swipe.SwipeIn; 
import com.mindorks.placeholderview.annotations.swipe.SwipeInState; 
import com.mindorks.placeholderview.annotations.swipe.SwipeOut; 
import com.mindorks.placeholderview.annotations.swipe.SwipeOutState; 

/** * 创建者:14-10-2016。 */

@Layout(R.layout.tinder_card_view)

公共类TinderCard延伸活动{

@View(R.id.profileImageView) 
private ImageView profileImageView; 

@View(R.id.nameAgeTxt) 
private TextView nameAgeTxt; 

@View(R.id.locationNameTxt) 
private TextView locationNameTxt; 

@View(R.id.user_index) 
private TextView userindex; 


@Click(R.id.lLayout) 
void openProfile() 
{ 

} 


private Profile mProfile; 
private Context mContext; 
private SwipePlaceHolderView mSwipeView; 

public TinderCard(Context context, Profile profile, SwipePlaceHolderView swipeView) { 
    mContext = context; 
    mProfile = profile; 
    mSwipeView = swipeView; 
} 

@Resolve 
private void onResolved(){ 
    Glide.with(mContext).load(mProfile.getImageUrl()).into(profileImageView); 
    nameAgeTxt.setText(mProfile.getName() + ", " + mProfile.getAge()+"," +mProfile.getId()); 
    locationNameTxt.setText(mProfile.getLocation()); 

} 

@SwipeOut 
private void onSwipedOut(){ 
    Log.d("EVENT", "onSwipedOut"); 
    mSwipeView.addView(this); 
} 

@SwipeCancelState 
private void onSwipeCancelState(){ 
    Log.d("EVENT", "onSwipeCancelState"); 
} 

@SwipeIn 
private void onSwipeIn(){ 
    Log.d("EVENT", "onSwipedIn"); 
} 

@SwipeInState 
private void onSwipeInState(){ 
    Log.d("EVENT", "onSwipeInState"); 
} 

@SwipeOutState 
private void onSwipeOutState(){ 
    Log.d("EVENT", "onSwipeOutState"); 
} 

}

回答

0

只是删除从XML android:onClick="openProfile",它会工作。