如何使TextView完全忽略触摸?

时间:2017-04-03 17:28:45

标签: java android textview

我有这段代码:

TextView result;

result.setClickable(false);

我的TextView仍以这种方式对点击做出反应:pic。正如您所看到的那样,视图变得阴影,这不是我想要的。

如果有办法让视图完全无法点击,我就会徘徊。此外,我不需要使用TextView,但可以使用任何可以显示数字的内容。

result.setEnabled(false);也无济于事,因为它只是遮挡视线,效果仍然存在

1 个答案:

答案 0 :(得分:1)

这是一个涟漪效应,要禁用它,你可以这样做:

result.setEnabled(false);

参考:http://developer.android.com/training/material/animations.html

此外,您可以尝试将其停用 <?xml version="1.0" encoding="utf-8"?> <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/grid" android:layout_width="match_parent" android:layout_height="match_parent" android:listSelector="@android:color/transparent" />

要禁用对GridView的影响,您可以尝试以下代码:

<?php
$con = mysqli_connect("localhost", "root", "", "project");

        if(!$con)
       {
           die('not connected');
       }
            $result=  mysqli_query($con, "SELECT name, stay, food, travel,  
    SUM(stay + food + travel) AS totalamount,doj
FROM placedetails ");



?>
<div class="container">  
<table class="table table-hover">
<thead>
    <tr>
        <th>place</th>
        <th>stay cost</th>
        <th>food cost</th>
        <th>flight cost</th>
        <th>Date of journey</th>
        <th>Total cost</th>
    </tr>

</thead>



        <?php

             while($row =mysqli_fetch_array($result))

             {
                 ?>
            <tbody>
              <tr>
                <td><?php echo $row['name']; ?></td>
                <td><?php echo $row['stay']; ?></td>
                <td><?php echo $row['food'] ;?></td>
                <td><?php echo $row['travel'] ;?></td>
                <td><?php echo $row['doj'] ;?></td>
                <td><?php echo $row['totalamount'] ;?></td>                
            </tr>

            </tbody>
        <?php
             }
             ?>
             </table>
            </div>
   </div>