
我想用透明背景显示警告对话框.我的警报对话框代码是:
AlertDialog.Builder imageDialog = new AlertDialog.Builder(SubProducts.this);
LayoutInflater inflater = (LayoutInflater)SubProducts.this.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.cust_toast_layout,(ViewGroup)findViewById(R.id.linearLayout2));
ImageView image = (ImageView)layout.findViewById(R.id.imageView1);
image.setPadding(0, 20, 0, 0);
imgLoader.DisplayImage(image_url, loader, image);
TextView tprice=(TextView)layout.findViewById(R.id.pricetext);
tprice.setText("$ "+pricedouble);
TextView tvdprh=(TextView)layout.findViewById(R.id.textView1);
tvdprh.setText(prohd);
WebView wv=(WebView)layout.findViewById(R.id.webview);
Spanned sub=Html.fromHtml(descp);
String s = "<html><head><style type='text/css' >@font-face {font-family:'myfont';src: url('file:///android_asset/fonts/ABeeZee-Regular.ttf');}body {margin:0px;color:000000;font-family: myfont;"
+ "text-align: justify;}</style></head><body>"
+ sub
+ "</body></html>";
wv.loadDataWithBaseURL("", s, "text/html", "utf-8", null);
wv.setVerticalScrollBarEnabled(true);
wv.setBackgroundColor(Color.TRANSPARENT);
wv.setPadding(5, 25, 5, 0);
ImageView imgcartl=(ImageView)layout.findViewById(R.id.imageView2);
imgcartl.setBackgroundResource(R.drawable.cartlines);
ImageView brobutton=(ImageView)layout.findViewById(R.id.imageView3);
brobutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intentlabl …Run Code Online (Sandbox Code Playgroud) 我有一个主题为Theme.Transparent的活动,它是:
<style name="Theme.Transparent" parent="android:Theme.Dialog">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">false</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:gravity">top</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我正试图摆脱它周围的边框和填充..我想填补屏幕的水平.没有灰色边框.请帮忙 :)

我想将背景设置为透明,所以我已经设置了以下代码
styles.xml
<style name="dialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我有使用Progressdialog类似下面的代码JAVA file和fragment.
Activity activity = getActivity() ;
mProgressDialog = new ProgressDialog(activity,R.style.dialog) ;
mProgressDialog.setCancelable(false) ;
mProgressDialog.show() ;
Run Code Online (Sandbox Code Playgroud)
但是我得到了如下图所示的进展,并且它没有透明的背景.

为什么背景不会变为透明?
我正在尝试使用圆角制作自定义的android对话框.我目前的尝试给了我这个结果.

正如您所看到的,角落是圆的,但它仍然保持完整的白色角落.
下面是我放在drawable文件夹中的xml,用于创建带有圆角的红色边框的蓝色对话框.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:shape="rectangle">
<solid android:color="@color/transparent_black" />
<corners android:radius="@dimen/border_radius"/>
</shape>
</item>
<item
android:left="@dimen/border_width"
android:right="@dimen/border_width"
android:top="@dimen/border_width"
android:bottom="@dimen/border_width" >
<shape android:shape="rectangle">
<solid android:color="@color/blue" />
<corners android:radius="@dimen/border_radius"/>
</shape>
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
下面是对话框的布局.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/fill"
android:orientation="vertical"
android:layout_margin="@dimen/spacing_normal"
android:padding="@dimen/spacing_normal"
android:background="@drawable/border_error_dialog" >
<RelativeLayout
style="@style/block"
android:layout_gravity="center" >
<ImageView
android:id="@+id/imageView1"
style="@style/wrap"
android:layout_alignParentLeft="true"
android:layout_centerHorizontal="true"
android:contentDescription="@string/content_description_filler"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/textView1"
style="@style/error_text"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/imageView1"
android:text="@string/error_login" />
</RelativeLayout>
<Button
android:id="@+id/button1"
style="@style/wrap"
android:layout_gravity="center"
android:text="Button" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
以下是我创建对话框的Activity.
@Override
protected void onCreate(Bundle savedInstanceState) { …Run Code Online (Sandbox Code Playgroud) android dialog transparent android-layout android-alertdialog
我试图使这个简单的Dialog半透明:
class TestDialog extends SherlockDialogFragment
{
public TestDialog()
{
super();
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceStateBundle )
{
AlertDialog.Builder builder1 = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater1 = getActivity().getLayoutInflater();
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
builder1.setView(inflater1.inflate(R.layout.dlg_test, null))
// Add action buttons
.setPositiveButton( "Ok", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int id)
{
// sign in the user ... …Run Code Online (Sandbox Code Playgroud) 我在我们的xml布局中应用了一个可绘制的背景,但它还包含如何删除它的边框?
当我放置角落然后它应用角落但它不适用于整个布局的角落(意味着内容不在边界区域之外).
这是我的可绘制文件
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#fff">
</solid>
<stroke
android:width="2dp"
android:color="@color/block_button_bg">
</stroke>
<corners
android:radius="10dp">
</corners>
</shape>
Run Code Online (Sandbox Code Playgroud)
这是我的xml布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:background="@drawable/custom_dialog_bg">
<TextView
android:id="@+id/txtDiaTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_dialog_title"
android:textColor="@color/black"
android:textStyle="bold"
android:gravity="center"
android:padding="8dp"
android:textAppearance="@android:style/TextAppearance.Medium"/>
<TextView
android:id="@+id/txtDiaMsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="6dp"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:text="@string/app_dialog_desc"
android:textColor="@color/black"
android:textSize="12sp"/>
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@color/alarm_color"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/yes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/yes"
android:textColor="#0C76EE"
android:textStyle="bold"
android:padding="5dp"
android:clickable="true"
android:layout_margin="5dp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/alarm_color"
/>
<TextView …Run Code Online (Sandbox Code Playgroud) 我正在使用 Accengage (Ad4Push),我想自定义它的对话框。Accengage 团队说可以使用自定义主题更改对话框样式,我就这样做了。我可以更改 textSize、textColor、windowBackground,但我仍然在对话框上看到灰色。请在这里查看我的照片。(我没有足够的声誉来发布图片)
我想将所有背景对话框更改为白色,但我不知道可以使用哪个属性来实现此目的。
这是我正在使用的属性。
<style name="CustomDialogTheme" parent="@android:style/Theme.Dialog">
<item name="android:background">@color/background_holo_light</item>
<item name="android:divider">@color/background_holo_light</item>
<item name="android:dividerHorizontal">@null</item>
<item name="android:dividerVertical">@null</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:textColorPrimary">@android:color/black</item>
<item name="android:buttonBarButtonStyle">@style/CustomDialogTheme.Button</item>
<item name="android:padding">2dp</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
<style name="CustomDialogTheme.Button">
<item name="android:background">@color/background_dark</item>
<item name="android:textColor">@color/background_holo_light</item>
<item name="android:layout_margin">8dp</item>
<item name="android:layout_marginLeft">16dp</item>
<item name="android:padding">8dp</item>
<item name="android:gravity">center</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我怎样才能使对话框的背景变成白色。(我只能用自定义样式更改样式,不能以编程方式更改,因为该对话框来自第三方库)
我正在尝试制作一个半透明的Dialog,以便您可以在开始之前在后台看到游戏.
我已经看过这篇关于如何让它变得透明的文章,但是没有什么真正的半透明或者是否可能.
我想要的有点像他提供的图片,但解决方案给出的是对话框完全消失的背景.
非常感谢!
在任何应用程序中,添加/编辑将相对较少的输入.我已经看到应用程序,尤其是日历,正在使用聪明的策略将这些显示为简单对话框,以便用户可能不会注意到设计形式中存在空白
如下所示

我的问题是,如何实现这一目标?