編輯:關於Android編程
公司網絡爛,自己又不想findview寫很多遍,所以自己寫了個小工具,自動findview,生成代碼到剪貼版.
test
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/home_backgroud"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<RelativeLayout
android:id="@+id/headerLine"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#3d61f3"
android:orientation="horizontal" >
<TextView
android:id="@+id/title"
style="@style/header"
android:text="兒童保護" >
</TextView>
<ImageView
android:id="@+id/setchild_menu_btn"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerVertical="true"
android:layout_marginLeft="3.0dip"
android:layout_marginRight="3.0dip"
android:layout_marginTop="3.0dip"
android:gravity="center"
android:src="@drawable/ic_back" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="@dimen/margin"
android:layout_marginRight="@dimen/margin"
android:layout_marginTop="@dimen/margin_top"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:text="開始時間"
android:textColor="@color/black"
android:textSize="@dimen/textsize"
android:gravity="center_vertical" />
<EditText
android:id="@+id/et_childstarttime"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="@dimen/margin"
android:layout_marginRight="@dimen/margin"
android:layout_marginTop="@dimen/margin_top"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:text="結束時間"
android:textColor="@color/black"
android:textSize="@dimen/textsize"
android:gravity="center_vertical" />
<EditText
android:id="@+id/et_childendtime"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="@dimen/margin"
android:layout_marginRight="@dimen/margin"
android:layout_marginTop="@dimen/margin_top"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:text="性別"
android:textColor="@color/black"
android:textSize="@dimen/textsize"
android:gravity="center_vertical" />
<EditText
android:id="@+id/et_childsex"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:hint="男/女"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="@dimen/margin"
android:layout_marginRight="@dimen/margin"
android:layout_marginTop="@dimen/margin_top"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:text="周期"
android:textColor="@color/black"
android:textSize="@dimen/textsize"
android:gravity="center_vertical"/>
<EditText
android:id="@+id/et_childperiod"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="@dimen/margin"
android:layout_marginRight="@dimen/margin"
android:layout_marginTop="@dimen/margin_top" >
<Button
android:id="@+id/setchild_ok"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="確認"
android:textColor="@color/black"
android:textSize="@dimen/textsize"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
生成代碼
<pre name="code" class="java"> private RelativeLayout headerLine;
private TextView title;
private ImageView setchild_menu_btn;
private EditText et_childstarttime;
private EditText et_childendtime;
private EditText et_childsex;
private EditText et_childperiod;
private Button setchild_ok;
private void bindview(){
headerLine=(RelativeLayout) findViewById(R.id.headerLine);
title=(TextView) findViewById(R.id.title);
setchild_menu_btn=(ImageView) findViewById(R.id.setchild_menu_btn);
et_childstarttime=(EditText) findViewById(R.id.et_childstarttime);
et_childendtime=(EditText) findViewById(R.id.et_childendtime);
et_childsex=(EditText) findViewById(R.id.et_childsex);
et_childperiod=(EditText) findViewById(R.id.et_childperiod);
setchild_ok=(Button) findViewById(R.id.setchild_ok);
}
Android基礎入門教程——8.3.14 Paint幾個枚舉-常量值以及ShadowLayer陰影效果
Android基礎入門教程——8.3.14 Paint幾個枚舉/常量值以及ShadowLayer陰影效果標簽(空格分隔): Android基礎入門
屏幕適配之百分比方案詳解
最近看到DrawerLayout,support v4中提供的類,想到對google提供的這些支持庫,自己一點都不熟悉,想著看看Google提供的支持庫都有什麼內容。結果
Android開源組件小結
前言 Android自帶的組件比較丑陋(個人感覺),自己寫組件比較復雜,而且必須熟悉android應用層開發的
Android Fragment使用之實例演示
Fragment是Android honeycomb 3.0