小编GrA*_*And的帖子

嵌套的preferences.xml

是否有可能将一个包含preferences.xml到另一个中,就像它可以用<include />标签进行布局一样?

让我们说:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen 
    xmlns:android="http://schemas.android.com/apk/res/android">
    <PreferenceScreen 
        android:title="@string/pref_group_title_visual">
        <include 
            preferences_filename="xml/pref_visual"/>
    </PreferenceScreen>
...
Run Code Online (Sandbox Code Playgroud)

android nested include preferences android-preferences

32
推荐指数
3
解决办法
6654
查看次数

ImageView:adjustViewBounds不能与layout_height ="fill_parent"一起使用?

我试图EditTextImageView左边的单排放置.但我无法正确缩放图像以匹配文本输入的高度.

布局很简单:

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:id="@+id/icon"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:adjustViewBounds="true"
            android:scaleType="fitStart"
            android:background="#f00"
            android:src="@drawable/icon" />
        <EditText
            android:id="@+id/text"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

(我用红色突出显示图像背景,以查看ImageView分配的实际空间)


如果我指定的确切高度ImageView:

            android:layout_height="48dp"
Run Code Online (Sandbox Code Playgroud)

然后我得到了我最需要的观点: 在此输入图像描述

但我不知道确切的高度EditText,所以我不能在ImageView这里指定它.


ImageView指定高度为填充其父级时(以匹配``EditText`高度):

            android:layout_height="fill_parent"
Run Code Online (Sandbox Code Playgroud)

然后我在图像和文本输入之间得到意想不到的额外余量: 在此输入图像描述

实际上,在这种情况下,ImageView宽度等于未缩放的图像宽度,而图像被缩放.


这是类似以下图所示,如果我指定layout_height48dp并设置adjustViewBoundsfalse:

            android:layout_height="48dp"
            android:adjustViewBounds="false"
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


因此,这里的问题是:如何正确定义布局以缩放图像以匹配编辑条目高度,同时将宽度ImageView缩小到缩放图像宽度?换句话说,如何摆脱这个额外的空间?

android scale imageview

15
推荐指数
2
解决办法
7926
查看次数

设置TCL以访问tcl库

我是TCL的新手,正在努力寻找其他模块.SOURCE命令帮助我包含了我在TCL程序中编写的其他代码.但是,我认为访问代码库时遇到问题.

例如,当我引用数学函数时,找不到它.我认为在搜索通过tchsh85调用的程序时,我必须要做一些事情来包括数学库在我的计算机上的位置.

invalid command name "::math::statistics::mv-ols"
None of these directories exist on my computer: info library= C:/Tcl/lib/tcl8.5 auto_path= C:/Tcl/lib/tcl8.5 C:/Tcl/lib c:/tcl/lib/teapot/package/win32-x86_64/lib c:/tcl/lib/teapot/package/tcl/lib tcl library= C:/Tcl/lib/tcl8.5 auto_index= source C:/Tcl/lib/tcl8.5/word.tcl auto_index= source C:/Tcl/lib/tcl8.5/tm.tcl auto_index= source C:/Tcl/lib/tcl8.5/tm.tcl auto_index= source C:/Tcl/lib/tcl8.5/safe.tcl auto_index= source C:/Tcl/lib/tcl8.5/parray.tcl auto_index= source C:/Tcl/lib/tcl8.5/history.tcl auto_index= source C:/Tcl/lib/tcl8.5/safe.tcl auto_index= source C:/Tcl/lib/tcl8.5/safe.tcl auto_index= source C:/Tcl/lib/tcl8.5/safe.tcl auto_index= source C:/Tcl/lib/tcl8.5/safe.tcl auto_index= source C:/Tcl/lib/tcl8.5/safe.tcl auto_index= source C:/Tcl/lib/tcl8.5/history.tcl auto_index= source C:/Tcl/lib/tcl8.5/package.tcl auto_index= source C:/Tcl/lib/tcl8.5/safe.tcl auto_index= source C:/Tcl/lib/tcl8.5/safe.tcl auto_index= source C:/Tcl/lib/tcl8.5/history.tcl auto_index= source C:/Tcl/lib/tcl8.5/safe.tcl auto_index= source C:/Tcl/lib/tcl8.5/safe.tcl auto_index= …
Run Code Online (Sandbox Code Playgroud)

tcl tclsh

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

if/else块中tcl注释的奇怪行为.这是tcl解释器的错误吗?

我发现了一个非常奇怪的bug(?),它花了我几乎一整天才在实际应用中找到它.在代码中有一个elseif被注释掉的块,它导致执行代码(我认为)无法执行.

我简化了重现这个奇怪的tcl行为的测试用例.

proc funnyProc {value} {
  if {$value} {
    return "TRUE"
#  } elseif {[puts "COMMENT :)"] == ""} {
#    return "COMMENT"
  } else {
    return "FALSE"
  }
  return "IT'S IMPOSSIBLE!!!"
}

puts [funnyProc false]
Run Code Online (Sandbox Code Playgroud)

您认为该计划将产生什么?

  1. puts注释行被执行.任何编程语言POV都是不可能的.
  2. 块之后的行也if {...} {return} else {return}被执行.true/false逻辑是不可能的.

我知道tcl-comment的行为类似于带有名称的命令,#并且在EOL之前使用所有参数.并且tcl解析器不喜欢注释中的不平衡花括号.但这个案例不符合我的理解.

也许我错过了重要的事情?如何正确地注释掉这些elseif块,所以不要有这些奇怪的副作用?

comments tcl

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