Android Custom Activity form size

Source: Internet
Author: User

Let's show you the picture first:


Look, is not very cool, hehe. Here I say the key point is to customize the size of the activity's form. This login box is not a Dialog, but an activity. How to define, that is, the theme of the activity is set to theme.dialog< Activity android:name= ". Alertdialogactivity "Android:theme=" @style/mytheme "/>mytheme.xml is my custom theme Mytheme.xml:<?xml version=" 1.0 " encoding= "Utf-8"?><resources>< style name= "MyTheme" parent= "Android:style/theme.dialog"> <item name= "Android:windowbackground" > @drawable/login_box</item> <item name= "android:windowistranslucent" >true</item> <item name= "Android: Windowanimationstyle ">@+android:style/Animation.Translucent</item></style></resources> Login_box.xml is the shape of my custom form: <?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "/http Schemas.android.com/apk/res/android "><solid android:color=" #00000000 "/><!--entity set to Transparent--><stroke Android:width= "1DP" color= "#FFFFFF"/><corners android:radius= "20DP"/><padding android:left= "1DP" android:top= "1DP" android:right= "1DP" android:bottom= "1DP"/></shape> in Dialog.xml, the key is to set the background picture < LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:orientation= "Vertical" Android: Layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:background= "@drawable/king3">  </LiinearLayout> Its use is to open up the entire form. OK, that's it.   http://blog.sina.com.cn/s/blog_629b701e0100xwul.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.