废话不多说,这是地址:http://android.lineten.net/layout.php。
有图有真相,比如:
![](http://img.blog.csdn.net/20140509113001484?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc2NyeTU1NjY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
你的XML假如是这样:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/logo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_logo" />
<Button
android:id="@+id/version_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/logo"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_54"
android:textColor="@color/colFFFFFF"
android:textSize="18sp"
android:text="版本号:1.0.0"
android:background="@drawable/bg_version_btn" />
<TextView
android:id="@+id/companyname_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@color/transparent"
android:text="@string/companyname"
android:textColor="@color/col8d8d8d"
android:layout_marginBottom="@dimen/font_size_40"
android:textSize="14sp" />
<TextView
android:id="@+id/email_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_22"
android:text="邮箱:bd@che08.com"
android:textColor="@color/colA0A0A0"
/>
</RelativeLayout>
生成代码例如以下:
// Content View Elements
private ImageView mLogo;
private Button mVersion_btn;
private TextView mCompanyname_tv;
private TextView mEmail_tv;
// End Of Content View Elements
private void bindViews() {
mLogo = (ImageView) findViewById(R.id.logo);
mVersion_btn = (Button) findViewById(R.id.version_btn);
mCompanyname_tv = (TextView) findViewById(R.id.companyname_tv);
mEmail_tv = (TextView) findViewById(R.id.email_tv);
}
有图有真相,比如:
![](file:///C:Userscwhl-xrzAppDataRoamingTencentUsers1343929308QQWinTempRichOle5R5@J1AA42XBH0M(]B}U(PX.jpg)
你的XML假如是这样:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/logo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_logo" />
<Button
android:id="@+id/version_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/logo"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_54"
android:textColor="@color/colFFFFFF"
android:textSize="18sp"
android:text="版本号:1.0.0"
android:background="@drawable/bg_version_btn" />
<TextView
android:id="@+id/companyname_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@color/transparent"
android:text="@string/companyname"
android:textColor="@color/col8d8d8d"
android:layout_marginBottom="@dimen/font_size_40"
android:textSize="14sp" />
<TextView
android:id="@+id/email_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_22"
android:text="邮箱:bd@che08.com"
android:textColor="@color/colA0A0A0"
/>
</RelativeLayout>
生成代码例如以下:
// Content View Elements
private ImageView mLogo;
private Button mVersion_btn;
private TextView mCompanyname_tv;
private TextView mEmail_tv;
// End Of Content View Elements
private void bindViews() {
mLogo = (ImageView) findViewById(R.id.logo);
mVersion_btn = (Button) findViewById(R.id.version_btn);
mCompanyname_tv = (TextView) findViewById(R.id.companyname_tv);
mEmail_tv = (TextView) findViewById(R.id.email_tv);
}