- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一个问题。
我们有布局自定义框架布局,具有缩放和平移功能
public class MyFrameLayout extends FrameLayout {
...
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
getChildAt(0).setTranslationX(vTranslate.x);
getChildAt(0).setTranslationY(vTranslate.y);
getChildAt(0).setScaleX(mScale.scaleFactor);
getChildAt(0).setScaleY(mScale.scaleFactor);
}
该类监听触摸手势并翻译/缩放其子级。我将它用作我的包含内容的 ViewGroup 的父 View 组。
<MyFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray"
android:clipChildren="false">
<android.support.constraint.ConstraintLayout
android:id="@+id/calc_constraint_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipChildren="false"/>
约束布局的内容以编程方式添加,它比屏幕或父组大。因此我们设置了 clipChildren=false。但是在转换前越界的 child 不响应 onClick 事件。
部分图片:
6% 的节点只是不响应点击。请帮帮我。
最佳答案
嗯。我找不到制作约束布局(白色布局)以适应具有 wrap_content 值的内容的方法。我的解决方法是根据节点树的宽度和高度动态增加约束布局的宽度和高度。
当您添加额外的节点时 - 布局措施会增长,您会看到它是如何调整的。然后为了修复它,我不得不重写父布局中的 onLayout() 方法(它在屏幕截图上是绿色的,但它是自定义的 ZoomableLayout)。
现在一切正常。但我不确定这个实现是否丑陋。
关于Android:clipChildren=false 和 onClickListner 用于剪裁的 child ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43370044/
我正在使用 com.sothree.slidinguppanel 它工作正常但是点击监听器不工作下面是我的代码 slidingLayout = (SlidingUpPanelLayout) findV
我在 alertbuilder 中填充的布局有两个按钮。但我无法为此设置 onClickListner。发生此异常。请看我的代码。自定义 alertDialogue 的 XML。
我创建了一个自定义 ListView ,这是它的代码。当我将 onClickListener 添加到 View 中时,只会为 ImageView 制作 toast。当我尝试将相同的监听器添加到其他 V
我有一个问题。 我们有布局自定义框架布局,具有缩放和平移功能 public class MyFrameLayout extends FrameLayout { ... @Override protec
我正在使用 android:textIsSelectable="true"以便我的文本有资格复制文本,在同一个 TextView 上我正在使用 onclicklistner,但是那个 clicklis
我正在开发一个有 listview 的应用程序,这是一个自定义的 listview,里面有一个按钮和一个 textview,这个 listview 包含 textview 和一个 button。我在按
我是一名优秀的程序员,十分优秀!