Skip to content

Commit 35e907a

Browse files
committed
Added Builder#overlayOffset example
1 parent f273744 commit 35e907a

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

sample/src/main/java/io/github/douglasjunior/androidSimpleTooltip/sample/MainActivity.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import android.widget.Button;
3636
import android.widget.EditText;
3737

38+
import io.github.douglasjunior.androidSimpleTooltip.OverlayView;
3839
import io.github.douglasjunior.androidSimpleTooltip.SimpleTooltip;
3940
import io.github.douglasjunior.androidSimpleTooltip.SimpleTooltipUtils;
4041

@@ -67,6 +68,7 @@ protected void onCreate(Bundle savedInstanceState) {
6768
findViewById(R.id.btn_custom_arrow).setOnClickListener(this);
6869
findViewById(R.id.btn_dialog).setOnClickListener(this);
6970
findViewById(R.id.btn_center).setOnClickListener(this);
71+
findViewById(R.id.btn_overlay_rect).setOnClickListener(this);
7072
}
7173

7274
@Override
@@ -253,6 +255,17 @@ public void onClick(View v) {
253255
.gravity(Gravity.CENTER)
254256
.build()
255257
.show();
258+
} else if (v.getId() == R.id.btn_overlay_rect) {
259+
new SimpleTooltip.Builder(this)
260+
.anchorView(v)
261+
.text(R.string.btn_overlay_rect)
262+
.gravity(Gravity.END)
263+
.animated(true)
264+
.transparentOverlay(false)
265+
.highlightShape(OverlayView.HIGHLIGHT_SHAPE_RECTANGULAR)
266+
.overlayOffset(0)
267+
.build()
268+
.show();
256269
}
257270
}
258271
}

sample/src/main/res/layout/activity_main.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@
113113
android:layout_height="wrap_content"
114114
android:layout_gravity="end"
115115
android:text="@string/btn_center" />
116+
117+
<Button
118+
android:id="@+id/btn_overlay_rect"
119+
android:layout_width="wrap_content"
120+
android:layout_height="wrap_content"
121+
android:layout_gravity="start"
122+
android:text="@string/btn_overlay_rect" />
116123
</LinearLayout>
117124
</ScrollView>
118125

sample/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<string name="btn_close">Close</string>
2020
<string name="btn_dialog">Inside dialog</string>
2121
<string name="btn_center">Screen center</string>
22+
<string name="btn_overlay_rect">Overlay Rect</string>
2223

2324
</resources>

0 commit comments

Comments
 (0)