The case of this blog is based on some of the requirements of my own project, so some and this irrelevant content and source code, we can ignore. This kind of function, I also toss for a long time, today only learned that the big God please do not laughed at,, l inside the picture to find good, good, first look at the effect:
Property_repair,xml
<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools "android:id=" @+id/container "android:layout_width=" Match_parent "android:layout_height= "Match_parent" android:background= "@color/main_background" tools:ignore= "Mergerootframe" > <relativelayout Android:id= "@+id/layout_top" android:orientation= "horizontal" android:layout_width= "Fill_parent" Android: layout_height= "40DP" android:layout_alignparenttop= "true" android:gravity= "center" > <include android:id= "@+id/shopcar_head" layout= "@layout/elife_head"/> </RelativeLayout> <relativelayout android:id= "@+id /layout_bottom "android:layout_alignparentbottom=" true "android:layout_width=" Fill_parent "Android:layo ut_height= "40DP" android:gravity= "center" > <button android:id= "@+id/button1" Android:layout_w Idth= "100DP" android:layout_height= "Fill_parenT "android:textsize=" 15SP "android:text=" commit issue "android:textcolor=" #ffffff "android:background=" @drawa Ble/round "/> <button android:id=" @+id/button2 "android:layout_width=" 100DP "android:layout _height= "Fill_parent" android:layout_torightof= "@+id/button1" android:textsize= "15SP" Android:layout_margin left= "2DP" android:textcolor= "#ffffff" android:background= "@drawable/round" android:text= "Cancel Repair"/> </r elativelayout> <relativelayout android:id= "@+id/content_layout" android:layout_width= "Fill_parent" android:layout_height= "Fill_parent" android:layout_above= "@id/layout_bottom" android:layout_below= "@id/layout _top "android:gravity=" center "> <linearlayout android:layout_width=" match_parent "Android:layo ut_height= "match_parent" android:orientation= "vertical" android:layout_alignparentbottom= "true" > < ; EditText AndroiD:id= "@+id/edittext1" android:layout_height= "120DP" android:layout_width= "Fill_parent" Android:textco Lor= "#1eb2ff" android:layout_margin= "12DP" android:gravity= "Top" android:textsize= "15SP" Andro Id:hint= "Please state your question ..." android:maxlength= "android:singleline=" false "android:background=" @drawable /editview_shape "/> <gridview android:id=" @+id/gridview1 "android:layout_width=" Fill_parent " android:layout_height= "200DP" android:layout_margin= "10DP" android:background= "#EFDFDF" android:h orizontalspacing= "5DP" android:verticalspacing= "5DP" android:numcolumns= "4" android:scrollbars= "None" Android:columnwidth= "90DP" android:stretchmode= "columnWidth" android:gravity= "Center" > < /gridview> <textview android:layout_width= "fill_parent" android:layout_height= "Wrap_content" Android:text= "(Long press the picture toTo delete the added picture) "android:textcolor=" #1eb2ff "android:gravity=" center "/> </LinearLayout> </relativ Elayout> </RelativeLayout>
Griditem_addpic.xml
<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android " android:layout_width=" match_parent " android:layout_height=" match_parent " android:gravity= "Center" android:descendantfocusability= "blocksdescendants" android:orientation= "vertical" > <relativelayout android:layout_gravity= "center" android:layout_width= "80DP" android:layout_ height= "80DP" android:orientation= "vertical" > <imageview android:layout_margintop= "10DP" android:layout_marginright= "10DP" android:id= "@+id/imag_oo" android:layout_width= "Fill_parent" android:layout_height= "fill_parent" android:scaletype= "Fitxy" android:src= "@drawable/ic_ Launcher "/> </RelativeLayout></LinearLayout>
Editview_shape.xml//This is to set the fillet, because I have this demand, we do not have the option to skip
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" android:shape= "Rectangle" android:padding= "10DP" > <!--fill EditView colors-- <soild Android:color= "#ffffff"/> <!--set the radian of the fillet, the larger the radius, the more rounded the corner of the EditView-- <corners android: radius= "15DP" android:bottomrightradius= "15DP" android:bottomleftradius= "15DP" android: topleftradius= "15DP" android:toprightradius= "15DP"/> <stroke android:color= "#1eb2ff" android:width= "4px"/> </shape>
Tijiao_pingjia.xml This is the layout of the pop-up window, and the same as above is my demand you can not
<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android "Android:layout_width=" Match_parent "android:layout_height=" match_parent "android:background=" @null "a ndroid:orientation= "vertical" > <linearlayout android:id= "@+id/tuuikuan_linea" android:layout_width = "200DP" android:layout_height= "100DP" android:background= "@drawable/round_1" android:orientation= "ve Rtical "> <textview android:id=" @+id/shifou "android:layout_width=" Match_parent " android:layout_height= "Match_parent" android:layout_weight= "1" android:gravity= "center" android:text= "Cancel Repair" android:textcolor= "#1eb2ff" android:textsize= "12sp"/> <linea Rlayout android:id= "@+id/xuanze" android:layout_width= "Match_parent" Android:layout_heigh T= "Match_parent" Android: layout_weight= "1" android:orientation= "horizontal" > <button android:id= "@+id/ Yes "android:layout_width=" match_parent "android:layout_height=" Match_parent " android:layout_weight= "1" android:background= "@null" android:focusable= "true" android:gravity= "Center" android:text= "is" android:textcolor= "#1eb2ff" Andro Id:textsize= "12SP"/> <button android:id= "@+id/no" Android:layout_width= "Ma Tch_parent "android:layout_height=" Match_parent "android:layout_weight=" 1 "an Droid:background= "@null" android:focusable= "true" android:gravity= "center" an Droid:text= "Cancel" android:textcolor= "#1eb2ff" android:textsize= "12sp"/> </linear Layout> </lineaRlayout></linearlayout>
Here is the program I because of the project needs, all my not mainactivity, but I need a class, everyone according to the circumstances of their own definition
Property_repair.java
Package Com.elife.property;import Java.util.arraylist;import Java.util.hashmap;import com.elife.app.R;import Android.app.activity;import Android.app.alertdialog;import Android.app.dialog;import Android.app.alertdialog.builder;import Android.content.dialoginterface;import Android.content.Intent;import Android.content.pm.activityinfo;import Android.database.cursor;import Android.graphics.bitmap;import Android.graphics.bitmapfactory;import Android.net.uri;import Android.os.bundle;import Android.provider.MediaStore ; Import Android.text.textutils;import Android.view.layoutinflater;import Android.view.view;import Android.view.view.onclicklistener;import Android.view.windowmanager;import Android.widget.adapterview;import Android.widget.adapterview.onitemclicklistener;import Android.widget.button;import Android.widget.EditText; Import Android.widget.gridview;import Android.widget.imageview;import Android.widget.radiobutton;import Android.widget.simpleadapter;import Android.widget.textview;import Android.widget.simpleadapter.viewbinder;import Android.widget.toast;public class Property_repair extends Activity { Private GridView GridView1; Grid display thumbnail private Button buttonpublish,button2,no,yes,button1; Publish button Private Final int image_open = 1; Open the picture tag private String pathimage; Select picture path private Bitmap bmp; Import temporary pictures private arraylist
Android Imitation hair talk about