Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@maxim-petlyuk
maxim-petlyuk / CloneView
Created August 23, 2018 10:04
Draw view from the existing original view
public class CloneView extends View {
private View mSource;
public CloneView(Context context) {
super(context);
}
public CloneView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
@maxim-petlyuk
maxim-petlyuk / ScrollSensitiveLinkMovementMethod
Last active November 7, 2018 12:15
LinkMovementMethod class, which helps to find, highlight and handle clicks on links inside the TextView, has the issue with processing onTouch() method - if you tap on the link and try to scroll the textview, you will see that no scrolling will occur. ScrollSensitiveLinkMovementMethod has better processing touches and allows you to scroll even i…
package your_package_name;
import android.text.Layout;
import android.text.Selection;
import android.text.Spannable;
import android.text.method.LinkMovementMethod;
import android.text.method.Touch;
import android.text.style.ClickableSpan;
import android.view.MotionEvent;
import android.widget.TextView;