我的自定义登录对话框
有以下布局<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/padding_large">
<ImageButton android:src="@drawable/ic_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/dialog.login.settings"
android:padding="@dimen/margin_medium" />
<TextView android:text="@string/dialog.login.text.user_name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText android:id="@+id/dialog.login.user_name"
android:layout_width="match_parent"
android:gravity="center"
android:ems="20"
android:layout_height="wrap_content"
android:inputType="text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView android:text="@string/dialog.login.text.password"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText android:id="@+id/dialog.login.password"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox android:id="@+id/dialog.login.show_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dialog.login.check.show_password"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_margin="@dimen/margin_medium"
android:checked="false" />
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/dialog.login.cancel"
android:drawableStart="@drawable/ic_exit_black"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/margin_medium"
android:text="@string/dialog.login.button.cancel" />
<Button android:id="@+id/dialog.login.connect"
android:text="@string/dialog.login.button.connect"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_marginStart="@dimen/margin_medium"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
当我创建对话框和setcontentview时,对话框的宽度变得等于第一行上图像按钮的宽度
如果删除它,它将变为EditText(dialog.login.user_name)的大小,其ems为20
当我使对话框的构造函数调用基本对话框构造函数时,主题为R.style.Theme.Material.Dialog它确实得到了正确的(大约3/4的屏幕),但问题是它忽略了我的主要和强调色(这是正常的)
有没有办法让对话框具有Theme.Material.Dialog大小,但仍然保留我自己的主要/强调颜色?
提前感谢您提供的任何帮助
答案 0 :(得分:0)
经过大量搜索后,似乎解决方案是实际替换主要主题的version: "2"
services:
elasticsearch_master:
image: elasticsearch:latest
command: "elasticsearch -Des.cluster.name=workagram -Des.node.master=true -Des.node.data=false"
ports:
- "9200:9200"
- 9300
elasticsearch1:
image: elasticsearch:latest
command: "elasticsearch -Des.cluster.name=workagram -Des.discovery.zen.ping.unicast.hosts=elasticsearch_master"
links:
- elasticsearch_master
属性,因此解决方案是:
dialogTheme