简体   繁体   English

android.gesture.GestureOverlayView没有显示在图形布局上

[英]android.gesture.GestureOverlayView doesn't show on the graphical layout

The following is part of my xml code: 以下是我的xml代码的一部分:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/table_detail"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="16dp"
    tools:context=".SignCheckFragment" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <android.gesture.GestureOverlayView
            android:id="@+id/gestureOverlayView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp" >
        </android.gesture.GestureOverlayView>          

        <TextView
            android:id="@+id/label_subtotal"
            style="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/subtotal" />

The following figure is the corresponding graphical layout. 下图是相应的图形布局。 The problem is that there is no GestureOverlayView 问题是没有GestureOverlayView

在此处输入图片说明

I know this is an old question, but here is an answer. 我知道这是一个老问题,但这是一个答案。

The problem is that in your XML code you have the follow dimensions for the gestureOverlayView android:layout_width="match_parent" android:layout_height="wrap_content" 问题是,在您的XML代码中,您具有以下手势尺寸:gestureOverlayView android:layout_width =“ match_parent” android:layout_height =“ wrap_content”

This means that until you specify some content the height will be 0dp, even though it will stretch all the way across the view - the width is match parent. 这意味着,除非您指定一些内容,否则高度将一直为0dp,即使它将一直延伸到整个视图中-宽度也与父级匹配。

The way to make this appear is to add some text or some other content. 使其显示的方法是添加一些文本或其他内容。

Alternatively give the GestureOverlayView some height and a background color and it should become visible. 或者,给GestureOverlayView一些高度和背景色,它应该变得可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM