如何将一个布局组件高度设置为与另一个组件相同:示例:我可以设置android:layout_height ="@ + id/info_box.height"或执行类似的操作吗?
我希望ImageView的高度与我的LinearLayout的高度相匹配
ImageView android:id="@+id/border"
android:src="@drawable/frame"
android:layout_below="@+id/title"
android:layout_width="fill_parent"
android:layout_height="????"
android:scaleType="fitXY"
android:drawingCacheQuality="auto"
/>
<LinearLayout
android:id="@+id/info_box"
android:orientation="vertical"
android:layout_below="@+id/title"
android:background="@layout/my_bg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
... other stuff . .
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 对于自定义AlertDialog,我可以覆盖肯定按钮以不关闭对话框吗?相反,我想运行一些编辑检查,并在检查失败时保持对话框打开.
protected Dialog onCreateDialog(int id) {
Dialog alertDialog = null;
builder = new AlertDialog.Builder(this);
switch(id) {
case LOGIN_USERID_BLANK:
builder.setMessage((String)getString(R.string.username_not_blank));
builder.setPositiveButton((String)getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Can I do something here so that the dialog does not close?
}
});
Run Code Online (Sandbox Code Playgroud)
打破;
我该怎么做呢?例如,当我在stackoverflow上创建一个问题时,Title文本字段在编辑TextView框中有这个:
你的编程问题是什么?请明确点.
一旦你插入它,或开始键入它就会消失.你如何为Android实现这一目标?谢谢,