小编Den*_*nis的帖子

setVisibility(GONE)视图变为不可见但仍占用空间

我有一个视图,实际上是一个按钮.这是它的XML布局(add_new.xml)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">
    <Button
        android:id="@+id/buttonNew"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/bText" 
        android:onClick="addNew"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

当我将其可见性设置为GONE时

v = getActivity().getLayoutInflater().inflate(R.layout.add_new, null);
v.setVisibility(View.GONE);
Run Code Online (Sandbox Code Playgroud)

它消失但仍占据空间.像这样:在此输入图像描述

这个按钮是一个标题,ListView由这个xml定义:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/porno" >

    <ImageView
        android:id="@+id/icon"
        android:layout_width="30dp"
        android:layout_height="40dp"
        android:layout_marginLeft="4dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="4dp"
        android:src="@drawable/ic_launcher">
    </ImageView>

    <TextView
        android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@+id/label"
        android:textSize="20dp" >
    </TextView>

</LinearLayout> 
Run Code Online (Sandbox Code Playgroud)

当其可见性设置为GONE时,我不希望它占用额外的列表项.正如文档中所述.

GONE - 此视图不可见,并且不需要任何空间用于布局.

关于如何使它不占用空间的任何想法?

谢谢,Dennis xx

PS我的listview位于FoldersFragment内部,ListFragment这里是我的MainActivity的xml,其中提供了FoldersFragment

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <fragment
        android:id="@+id/foldersFragment"
        android:layout_width="200dip"
        android:layout_height="match_parent"
        class="com.example.fragments.FoldersFragment" >
    </fragment> …
Run Code Online (Sandbox Code Playgroud)

android android-listview android-view

53
推荐指数
3
解决办法
3万
查看次数

Spark可以从pyspark访问Hive表,但不能从spark-submit访问

所以,当从pyspark运行时我会输入(没有指定任何上下文):

df_openings_latest = sqlContext.sql('select * from experian_int_openings_latest_orc')
Run Code Online (Sandbox Code Playgroud)

..它工作正常.

但是,当我运行我的脚本时spark-submit,就像

spark-submit script.py 我把以下内容放入

from pyspark.sql import SQLContext
from pyspark import SparkConf, SparkContext
conf = SparkConf().setAppName('inc_dd_openings')
sc = SparkContext(conf=conf)
sqlContext = SQLContext(sc)

df_openings_latest = sqlContext.sql('select * from experian_int_openings_latest_orc')
Run Code Online (Sandbox Code Playgroud)

但它给了我一个错误

pyspark.sql.utils.AnalysisException:你找不到:experian_int_openings_latest_orc;'

所以它没有看到我的表.

我究竟做错了什么?请帮忙

PS Spark版本在Amazon EMR上运行1.6

python hadoop apache-spark pyspark

16
推荐指数
2
解决办法
2万
查看次数

使用PL/SQL在指定目录中列出文件

是否可以仅使用PL/SQL获取存储在指定目录中的所有文件(及其扩展名)的列表?(使用Java程序和其他花哨的东西.只是普通的PL/SQL代码)

PS如果有可能,请告诉我该怎么做:)

sql plsql

9
推荐指数
1
解决办法
2万
查看次数

访问正在写入的文件

You use the hadoop fs –put command to write a 300 MB file using and HDFS block size of 64 MB. Just after this command has finished writing 200 MB of this file, what would another user see when trying to access this file?

a.) They would see Hadoop throw an ConcurrentFileAccessException when they try to access this file.
b.) They would see the current state of the file, up to the last bit written by the command.
c.) They …
Run Code Online (Sandbox Code Playgroud)

hadoop hdfs

9
推荐指数
2
解决办法
3689
查看次数

PopUpWindow和Dialog有什么区别?

基本上问题在标题中说明.使用一个或另一个的任何偏好?也许某些特定的任务,其中一个是优越的/更有效/更好的另一个?

android android-dialog

7
推荐指数
2
解决办法
1万
查看次数

/ var/www/...中的Django static_root - 没有collectstatic的权限

我的STATIC_ROOT文件夹被指定/var/www/app_name/static为非sudo用户通常不应该访问的文件夹.

它是由具有sudo权限的用户创建的.现在我正在尝试collectstatic与我自己的用户,它说"Permission denied...",毫不奇怪.

我该如何正确收集静态文件?在哪个用户下?

linux django permissions

6
推荐指数
1
解决办法
3131
查看次数

FrameLayout底部带有TextView

我有这样的FrameLayout.它包含两个重叠图像:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/my_frame"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ImageView 
        android:id="@+id/image_areas"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:scaleType="fitCenter"
        android:src="@drawable/image_mask"
        android:visibility="invisible"/>
    <ImageView
        android:id="@+id/image"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:scaleType="fitCenter"
        android:src="@drawable/walker"/>

</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

我想在TextView下面添加一个FrameLayout.是否有可能或确实FrameLayout占据了屏幕上的所有空间?我可以把我的FrameLayout和TextView放在一起 LinearLayout吗?

编辑:问题是TextView当我将它与我的FrameLayout一起放入LinearLayout或RelaiveLayout时,我的显示不会显示.

android android-layout

5
推荐指数
1
解决办法
1万
查看次数

将 BigQuery 中的数据导出到本地 PostgreSQL/MySql 数据库

我是 BigQuery 和 BigQuery 的 Python API - 处女。

我的任务是:使用 BigQuery 和 Python APIgoogle open dataset 中 提取数据,将数据加载到 MySql/PostgreSQL 本地数据库(安装在我电脑上的那个)

我看到它的方式(经过我 2 小时的研究)是:将数据拉入本地 csv 文件(使用这种示例代码),将文件中的数据加载到数据库中。

这是否类似于执行任务的正确方式?

如果没有,您能否提供一些建议/说明?

提前致谢。

python google-bigquery

5
推荐指数
1
解决办法
7827
查看次数

什么是语义堆栈模型中的统一逻辑以及谁应该处理它?

基本上,经过几个小时的研究后,我仍然不知道语义Web堆栈模型中的统一逻辑层是什么,以及它的问题是要处理它.

logic semantic-web

4
推荐指数
1
解决办法
1345
查看次数

并行执行具有不同参数的相同 Python 程序

我如何并行执行相同的 python 程序(我正在考虑 x10),唯一的区别是两个表示时间范围的输入参数?我需要它进行一些数据处理,否则将需要很长时间才能完成

我知道我可以通过一个接一个地启动 10 个脚本在 shell 中手动完成,但这似乎不是最“优雅”的解决方案 + 我也很想在“主”python 中为每个程序动态定义参数程序。

有没有办法做到这一点?

python python-3.x

4
推荐指数
1
解决办法
4276
查看次数