android - Using an image streches dialog to full height -
i want use image dialog's background makes dialog high screen. checked this , this , this answers , suggest same it's not working me.
<?xml version="1.0" encoding="utf-8"?> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:cliptopadding="true" xmlns:android="http://schemas.android.com/apk/res/android"> <imageview android:src="@drawable/wood" android:cliptopadding="true" android:scaletype="fitxy" android:adjustviewbounds="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_aligntop="@+id/dialog_layout_main" android:layout_alignbottom="@id/dialog_layout_main" android:layout_alignleft="@id/dialog_layout_main" android:layout_alignright="@id/dialog_layout_main" /> <linearlayout android:id="@+id/dialog_layout_main" android:layout_width="match_parent" android:layout_height="wrap_content" android:cliptopadding="true" android:orientation="vertical" android:padding="20dp" android:background="@drawable/wood"> <textview android:id="@+id/tv_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:gravity="center_horizontal" android:text="you're getting better!" android:textsize="24sp" android:textcolor="#486783"/> <textview android:id="@+id/tv_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:gravity="center_horizontal" android:layout_margintop="10dp" android:visibility="gone" android:text="do know better?" android:textsize="22sp" android:textcolor="#486783"/> <textview android:id="@+id/tv_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:gravity="center_horizontal" android:layout_margintop="20dp" android:text="sign in google+ save progress in cloud , compare results against other players!" android:textsize="20sp" android:textcolor="#486783"/> <button android:id="@+id/btn_signin" android:background="@drawable/google_button_selector" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="20dp" android:layout_marginright="20dp" android:layout_margintop="20dp" android:gravity="center" android:layout_gravity="center_horizontal" android:text="sign in google+" android:textcolor="#ffffff" android:textsize="18sp" /> </linearlayout> </relativelayout>
oh, , specify width of layout as
displaymetrics metrics = getresources().getdisplaymetrics(); int width = metrics.widthpixels; dialogsignin.getwindow().setlayout((9 * width) / 10, linearlayout.layoutparams.wrap_content);
Comments
Post a Comment