- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
请看下图来理解问题:
如您所见,有一个 RelativeLayout
包含一个自定义 View
和一个 LinearLayout
。
在它们之间,还有另一个 View
,Visibility
被设置为 GONE
。现在,当我按下 Button
时,我想将 GONE
View 的可见性更改为 VISIBLE
,并重新排列 RelativeLayout
,以便第三个 View
位于自定义 View
和 LinearLayout
之间。当我按下另一个按钮时,我想再次让第三 View 消失。我怎样才能做到这一点?
这是我的 XML:
<view
android:id="@+id/CanvasView"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_above="@+id/HorizontalScrollView"
android:layout_centerHorizontal="true"
android:layout_margin="0dp"
android:layout_marginBottom="0dp"
android:layout_marginTop="0dp"
class="com.example.CanvasView"
android:orientation="vertical" />
<HorizontalScrollView
android:id="@+id/HorizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/linearLayout2"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:visibility="gone" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:orientation="horizontal" >
//SOME BUTTONS HERE
</LinearLayout>
</HorizontalScrollView>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="5dp" >
<Button
android:id="@+id/button1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="0.4"
android:maxWidth="200dp"
android:text="Clear"
android:textColor="@android:color/white"
android:textSize="20sp" />
<Button
android:id="@+id/settingsButton"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_gravity="center_vertical|center_horizontal"
android:background="@drawable/settings_button_selector" />
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="0.4"
android:enabled="false"
android:maxWidth="200dp"
android:text="Recognize"
android:textColor="@android:color/white"
android:textSize="20sp" />
</LinearLayout>
如果我只在 OnClick() 方法中设置第三个 View 的 Visibility,它会出现在 LinearLayout 上方,它会覆盖自定义 View (我之前试过)。换句话说,它不会将 RelativeLayout 向上移动。
最佳答案
findViewById(R.id.button1).setOnClickListener(new OnClickListener(){
public void onClick(View v) {
findViewById(R.id.hiddenview).setVisibility(View.GONE);
findViewById(R.id.relativelayout).invalidate();
}
});
findViewById(R.id.button2).setOnClickListener(new OnClickListener(){
public void onClick(View v) {
findViewById(R.id.hiddenview).setVisibility(View.VISIBLE);
findViewById(R.id.relativelayout).invalidate();
}
});
关于java - RelativeLayout 在 view.setVisibility(View.GONE) 和 view.setVisibility(View.VISIBLE) 之后刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17398975/
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
刚从 vi 转到 Emacs。 我想将键盘顶部的所有数字重新绑定(bind)到它们移位的对应数字(即 1 个映射到 !,2 个映射到 @,等等),同时将数字键盘数字保持为简单数字. 我很好地重新映射了
我目前在远程主机上使用 VI,由于某种原因,一些命令映射不正确。例如当按下小写时 x ,而不是删除光标下的字符,它实际上删除了光标前两个空格的字符,因此,如果输入以下文本 BOTY 并且我将光标放在
如何更改用于在 vi 中突出显示搜索的颜色?现在黄色背景上的白色字母完全难以辨认。我宁愿它只是反转配色方案,即白色背景上的黑色字母或者黑色背景上的红色字母。但是当前的配色方案无法使用。 最佳答案 :h
我需要检索文件中字符的字符位置。我如何使用 Vi 做到这一点? 最佳答案 搜索你想要的字符: / 然后按Ctrl-g .您应该会看到类似 45,28 的内容在左下方。第二个数字是字符的位置。第一个数字
在 vi 中为一大块代码增加或减少缩进的最简单方法是什么? 最佳答案 在 vim 中(不确定这是否也适用于您),您使用 >>缩进一行。与 vim 中的几乎每个命令一样,在要执行多次的命令之前键入一个数
我无法在 shell 脚本中键入(Control A)字符。通过使用 (Ctrl+V) 然后 (Ctrl+A)。我无法这样做。 我可以从 cli 中给出 (Ctrl+A),但不能在 shell 脚本中
有没有办法在 VI 中轻松创建文本标题?我想创建一个如下所示的标题,而不必为了居中而计算字符。 # ********** a centered title ********** 有什么 vi vood
简单地说,我想做与A相反的事情。在 vi — 所以在哪里 A将您置于插入模式并将您带到当前行的末尾,我希望在当前行的开头进入插入模式。 那么,是否有等价于: 0 i 一键敲击? 我确定这之前一定有人问
是否可以使用 vi/vim 命令将数字 1-10 写在不同的行上? 最佳答案 :call append ('.', range (1, 10)) 关于vi - 在 vi 中编程,我们在Stack Ov
当使用 vi 编辑器读取长文件时,如果确实需要这样做,可以通过一些快捷方式返回到文件的开头,这是非常好的。即使 ctrl+B 有时也太慢。有人知道这样的工具吗? 最佳答案 使用 vi 打开文件后 1)
我尝试遵循以下操作: How to delete selected text in VI editor 但是 5dd 给出 E492: Not an editor command: 5dd 然后我尝试
我正在使用vi编辑器编写脚本,但是我错误地删除了一些代码行而不保存。现在我想撤消更改。我发现这样做的方法是使用u击键来撤消更改,并且效果很好。 现在我想在当前状态下退出 vi 编辑器而不保存更改,所以
我在 vi 编辑器中的复杂搜索模式中犯了一个错误,现在想修改它。 我知道 vi 会记住最后的搜索模式,但我可以查看和编辑它吗? 最佳答案 现代 vi/vim 保留 vi 中使用的 : 和 / 命令的历
我老师的笔记说 "There is a tags file that can be built which will make finding things in the kernel source
nyy yanks n 行,这是正常的行为,但是为什么 y yank 两行而 yy 仅 yanks 一行? 这对我来说听起来很违反直觉。我想知道是什么导致了这个决定。不确定 vim,因为我现在正在使用
有时,我主要用英语写作,我需要输入一个特殊的 unicode 字符,例如度数符号或希腊字母 theta。但是,记住 Unicode 十六进制值或从 Internet 复制/粘贴这两种选择都非常不令人满
所以我制作了一个脚本,它从许多不同的文件中收集数据: #!/bin/bash mkdir DATAPOOL"$1" grep achi *out>runner grep treat *out>>run
我试图在不退出 session 的情况下保存 vi session 的内容。有什么办法可以做到这一点? 最佳答案 :w 就是你要找的命令 关于linux - 在不退出 vi session 的情况下保
我读了 vim 正则表达式示例 s/vi/VIM/g 和 s:^vi$:VIM: / 和 : 有什么区别, 搜索但发现一些有用的 Material 。 最佳答案 Vim 允许您任意更改用于开始和结束搜
我是一名优秀的程序员,十分优秀!