2016-07-27 6 views
0

私のアプリで私自身のFacebook反応ポップアップを実装する必要があります。検索中、私は下のgithubアプリhttps://github.com/chRyNaN/Reactionsで出会った。 ReactionViewクラスのShowメソッドを、以下のコードセットを使用して呼び出すようにしました。Facebookの新しいemojisを実装する方法:愛、笑、うわー、悲しい、アンドロイドで怒っている?

ReactionView reactionView = new ReactionView(MainActivity.this); 
     final Button mReactionView = (Button)findViewById(R.id.openpopup); 
     mReactionView.setOnTouchListener(new View.OnTouchListener() { 
      @Override 
      public boolean onTouch(View v, MotionEvent event) {    
       reactionView.show(event); 
       return true; 
      } 
     }); 

しかし、反応ポップアップは表示されません。私は確信していません、私は行方不明ですか?誰も私にこれを助けることができますか?

注:レイアウトフォルダとメインアクティビティクラスにGithubソースがありません。

答えて

0

それはここでは、この

public class MainActivity extends AppCompatActivity { 

    private ReactionView reactionView; 
    private Button button; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     init(); 

    } 

    private void init() { 
     reactionView = (ReactionView) findViewById(R.id.reaction); 
     button = (Button) findViewById(R.id.button); 

     button.setOnTouchListener(new View.OnTouchListener() { 
      @Override 
      public boolean onTouch(View view, MotionEvent motionEvent) { 
       reactionView.show(motionEvent); 
       return false; 
      } 
     }); 
    } 
} 

のように起動することができ、レイアウト

<?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_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center" 
    tools:context="me.superup.reactions.MainActivity"> 

    <Button 
     android:id="@+id/button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/app_name"/> 

    <me.superup.reactions.reactions.ReactionView 
     android:id="@+id/reaction" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/button"/> 

</RelativeLayout> 
ある
関連する問題