相关疑难解决方法(0)

Android中状态栏的高度

Android中状态栏的高度是多少?总是一样的吗?

根据我的测量结果,它似乎是25dp,但我不确定它是否在所有平台上具有相同的高度.

(我想知道这是为了正确实现从没有状态栏的活动到执行状态栏的活动的淡入淡出过渡)

android statusbar

314
推荐指数
16
解决办法
33万
查看次数

如何将边距设置为自定义对话框?

有谁知道我如何设置自定义对话框的边距?我问,因为我有一个自定义对话框但是在显示时它会延伸以填充父对象,即使我在布局参数上明确设置了WRAP_CONTENT.

基本上,对话框包含一个listview,其元素必须向下滚动,当元素为1时,它不会拉伸,但是当添加更多项时,对话框占据整个屏幕.

有什么建议?我尝试了所有可能的解决方案组合而没有取得满意的结果

编辑:添加了对话框布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_margin="50dip"   
    android:orientation="vertical"
    android:layout_gravity="top|center">

    <FrameLayout android:layout_width="fill_parent" android:layout_margin="5dip" android:layout_height="wrap_content">

            <TextView android:layout_width="wrap_content"        android:layout_height="wrap_content" 
                android:layout_gravity="center"
                android:textSize="20sp" android:textColor="@color/black"/>

            <Button android:layout_height="32dip" android:layout_width="32dip" 
                android:id="@+id/guide_dialog_cross_button"
                android:background="@drawable/button_cross_white"/>

        </FrameLayout>


    <ListView android:layout_width="fill_parent" android:layout_height="wrap_content" 
        android:fadingEdge="none"
        android:layout_margin="5dip"/>

    <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_margin="5dip" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android dialog

52
推荐指数
6
解决办法
6万
查看次数

如何在Dialog中设置边距

我已经Dialog在我的Andorid 应用程序中用于显示广告.但是我必须显示这个Dialog大约50dp来自buttom的顶部所以我认为我们应该设置DialogGravity buttom并设置它的buttom边距50dp.但我不能使用保证金.所以Dialog请建议我如何解决这个问题.

XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/popup_element"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/dialogback"
    android:orientation="vertical" >

    <WebView
        android:id="@+id/webView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

Java的:

final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
LayoutInflater inflator = (LayoutInflater) getApplicationContext()
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflator.inflate(R.layout.ad, null, false);
dialog.setContentView(view);
dialog.getWindow().setGravity(Gravity.BOTTOM);
dialog.setCancelable(true);
WebView webView = (WebView) dialog.findViewById(R.id.webView);
webView.loadUrl("");
webView.setWebViewClient(new MyWebViewClient());
webView.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        dialog.dismiss();
    }
});
dialog.show();
Run Code Online (Sandbox Code Playgroud)

android dialog webview

12
推荐指数
3
解决办法
4万
查看次数

标签 统计

android ×3

dialog ×2

statusbar ×1

webview ×1