2016-10-17 102 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",它會工作。