帶動畫效果的簡單Tips顯示

https://github.com/nhaarman/supertooltips

介紹:

SuperToolTips 是一個根據觸發位置顯示提示條的控件。

運行效果:

使用說明:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
 
    <TextView
        android:id="@+id/activity_main_redtv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />
 
    <com.nhaarman.supertooltips.ToolTipRelativeLayout
        android:id="@+id/activity_main_tooltipRelativeLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</RelativeLayout>
 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
 
    ToolTipRelativeLayout toolTipRelativeLayout = (ToolTipRelativeLayout) findViewById(R.id.activity_main_tooltipRelativeLayout);
 
    ToolTip toolTip = new ToolTip()
                        .withText("A beautiful View")
                        .withColor(Color.RED)
                        .withShadow()
                        .withAnimationType(ToolTip.ANIMATIONTYPE_FROMTOP);
    myToolTipView = toolTipRelativeLayout.showToolTipForView(toolTip, findViewById(R.id.activity_main_redtv));
    myToolTipView.setOnToolTipViewClickedListener(MainActivity.this);
}
相關文章
相關標籤/搜索