Android Api Demos登顶之路(十)Overscan

这个demo实现了对控件的绽放功能,其实要实现这个功能,只需在布局文件中将控件的android:scaleType=”fitXY”这个属性设置为在横向和纵向拉伸即可。
本例中还引用了android:fitsSystemWindows=”true”这个属性,意思是指设置应用布局时是否考虑系统窗口布局;如果为true,将调整系统窗口布局以适应你自定义的布局。比如系统有状态栏,应用也有状态栏时。
本例使用的是帧布局,帧布局就如同photoshop的图层的概念,在一个布局之上再添加一个布局层。
同时在配置文件中对activity应用了去除titlebar,和全屏的样式。
布局文件activity_overscan.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true" >

    <ImageView 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/frantic"
        android:scaleType="fitXY"/>
    <ImageView 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/box_white"/>
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="3dp"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="Content"/>

</FrameLayout>

配置文件中设置activity

 <activity
            android:name="com.example.apidemos.app.activity.OverScanActivity"
            android:label="@string/activity_overscan"
            android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="COM_FISHTOSKY_CODE" />
            </intent-filter>
        </activity>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值