編輯:Android開發教程
前言
前幾天有在微博上推薦過一個博客,看他文章時發現了這個屬性。有些屬性不常用,但需要的時候非常有用,於是做了個例子,正好項目用到,與大家分享一下。
正文
一、效果圖

看到這個圖時你可以先想想如果是你,你怎麼實現這個效果。馬上想到用RelativeLayout?NO,NO,NO,,,
 
二、實現代碼
<?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:clipChildren="false"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1.0" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dip"
android:background="#B0C4DE"
android:orientation="horizontal" >
<ImageView
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:scaleType="fitCenter"
android:src="@drawable/ic_launcher" />
<ImageView
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:scaleType="fitCenter"
android:src="@drawable/ic_launcher" />
<ImageView
android:layout_width="0dip"
android:layout_height="64dip"
android:layout_gravity="bottom"
android:layout_weight="1.0"
android:scaleType="fitCenter"
android:src="@drawable/ic_launcher" />
<ImageView
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:scaleType="fitCenter"
android:src="@drawable/ic_launcher" />
<ImageView
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:scaleType="fitCenter"
android:src="@drawable/ic_launcher" />
</LinearLayout>
</LinearLayout>
代碼說明:
1、只需在根節點設置android:clipChildren為false即可,默認為true
2、可以通過android:layout_gravity控制超出的部分如何顯示。
3、android:clipChildren的意思:是否限制子View在其范圍內
三、 其他
在做動畫的時候非常有用(聽說的,,,回頭寫例子試試看)
Android Service服務(一) Service
一、Service簡介Service是android 系統中的四大組件之一(Activity、Service、BroadcastReceiver、 ContentProv
Android開發入門(五)屏幕組件 5.3 AbsoluteLayout絕對布局
使用AbsoluteLayout,可以指定它其中的子View的確切位置。觀察如下main.xml中的代碼:<?xml version="1.0"
android+json+php+mysql實現用戶反饋功能
相信每個項目都會有用戶反饋建議等功能,這個實現的方法很多,下面是我實現的方法,供大家交流。首 先看具體界面,三個字段。名字,郵箱為選填,可以為空,建議不能為空。如有需要可
Android應用更換package name以及ui refactoring error問題
package name是Android系統中為每一個應用程序分配的一個標識,每個應用的標識都必須是不同的。在應用開發過程中,有時候可能需要對package name進行