OK, 看到这里应该明白我标题的意思了吧.哈哈.

首先, 来个布局(activity_select_pic.xml)

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 <?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:gravity="center_horizontal" >
    <LinearLayout
        android:id="@+id/pop_layout_select_pic"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:gravity="center_horizontal"
        android:orientation="vertical" >
        <TextView
            android:id="@+id/text_take_photo"
            android:layout_width="fill_parent"
            android:layout_height="50.0dip"
            android:layout_marginLeft="10.0dip"
            android:layout_marginRight="10.0dip"
            android:gravity="center"
            android:orientation="horizontal"
            android:text="拍照"
            android:background="@drawable/shape_popup_top" //这里, 需要讲
            android:textColor="#ff006cff"
            android:textSize="18.0sp" />
         
        <View
            android:layout_width="fill_parent"
            android:layout_height="1.0dip"
            android:layout_marginLeft="10.0dip"
            android:layout_marginRight="10.0dip"
            android:background="@color/liuliu_border" />
         
        <TextView
            android:id="@+id/text_pick_photo"
            android:layout_width="fill_parent"
            android:layout_height="50.0dip"
            android:layout_marginLeft="10.0dip"
            android:layout_marginRight="10.0dip"
            android:gravity="center"
            android:background="@drawable/shape_popup_bottom"//这里, 需要讲
            android:orientation="horizontal"
            android:text="从相册"
            android:textColor="#ff006cff"
            android:textSize="18.0sp" />
        <View
            android:layout_width="fill_parent"
            android:layout_height="1.0dip"
            android:layout_marginLeft="10.0dip"
            android:layout_marginRight="10.0dip"
            android:background="@color/liuliu_border" />
        <TextView
            android:id="@+id/text_cancle"
            android:layout_width="fill_parent"
            android:layout_height="50.0dip"
            android:layout_margin="10.0dip"
            android:background="@drawable/shape_popup"//这里, 需要讲
            android:gravity="center"
            android:orientation="horizontal"
            android:text="取消"
            android:textColor="#ff006cff"
            android:textSize="18.0sp"
            android:textStyle="bold" />
    </LinearLayout>
</RelativeLayout>

上面已经标注了3个地方需要讲一下, 就是TextView上面的拍照, 选取, 取消的这个三个的背景

分别是下面三个在drawable-hdpi里面的文件

shape_popup_top.xml, 就是长方形的上边的两个角是圆润的(左上角, 右上角)

?
1
2
3
4
5
6
7
8
9
10
11
 <?xml version="1.0" encoding="utf-8"?>
<layer-list
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <solid android:color="#ffffffff" />
            <!-- 左上角 右上角-->
            <corners android:topLeftRadius="4.0dip" android:topRightRadius="4.0dip" android:bottomLeftRadius="0.100000024dip" android:bottomRightRadius="0.100000024dip" />
        </shape>
    </item>
</layer-list>

shape_popup_bottom.xml, 就是长方形的下边的两个角是圆润的(左下角, 右下角)

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 <?xml version="1.0" encoding="utf-8"?>
<layer-list
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
        <!-- 白色-->
            <solid android:color="#ffffffff" />
            <!-- 左下角, 右下角-->
            <corners 
                android:topLeftRadius="0.100000024dip" 
                android:topRightRadius="0.100000024dip" 
                android:bottomLeftRadius="4.0dip" 
                android:bottomRightRadius="4.0dip" />
        </shape>
    </item>
</layer-list>

shape_popup.xml

?
1
2
3
4
5
6
7
8
9
10
11
 <?xml version="1.0" encoding="utf-8"?>
<layer-list
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <solid android:color="#ffffffff" />
            <!--四个角都是圆的-->
            <corners android:radius="4.0dip" />
        </shape>
    </item>
</layer-list>

OK, 到这里之后, 就完成了布局. 但是还没完, 还有调出方式, 我们要放在下面, 而且要是透明的, 这个就要在manifest中去规定了

?
1
2
3
4
5
6
 <activity
            android:name="com.gdut.pet.ui.ActivitySelectPic"
            android:label="@string/personal_central" 
            android:theme="@style/DialogStyleBottom"
            >
<!--这个是在manifest中定义的一个activity, 规定了他的theme是DialogStyleBottom-->

上面这个这个是在manifest中定义的一个activity, 规定了他的theme是DialogStyleBottom,

DialogStyleBottom如下(在values文件夹下的styles.xml)

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 <style name="AnimBottom" parent="@android:style/Animation">
        <item name="android:windowEnterAnimation">@anim/push_bottom_in</item>
        <item name="android:windowExitAnimation">@anim/push_bottom_out</item>
    </style>
    <style name="DialogStyleBottom" parent="android:Theme.Dialog">
        <item name="android:windowAnimationStyle">@style/AnimBottom</item>
        <item name="android:windowFrame">@null</item>
        <!-- 边框 -->
        <item name="android:windowIsFloating">false</item>
        <!-- 是否浮现在activity之上 -->
        <item name="android:windowIsTranslucent">true</item>
        <!-- 半透明 -->
        <item name="android:windowNoTitle">true</item>
        <!-- 无标题 -->
        <item name="android:windowBackground">@android:color/transparent</item>
        <!-- 背景透明 -->
        <item name="android:backgroundDimEnabled">true</item>
        <!-- 模糊 -->
    </style>

上面的应该能看得明白了

OK, 还差最后一部了, 就是出来的方式, 这里用到animation,

文件在anim文件夹下面

push_bottom_in.xml

?
1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="utf-8"?>
<!-- 上下滑入式 -->
<set xmlns:android="http://schemas.android.com/apk/res/android" >
    <translate
        android:duration="200"
        android:fromYDelta="100%p"
        android:toYDelta="0"        
     />      
</set>

push_bottom_out.xml

?
1
2
3
4
5
6
7
8
9
 <?xml version="1.0" encoding="utf-8"?>
<!-- 上下滑出式 -->
<set xmlns:android="http://schemas.android.com/apk/res/android" >
     
    <translate
        android:duration="200"
        android:fromYDelta="0"
        android:toYDelta="50%p" />
</set>

Android 发表说说一般用到的界面布局相关推荐

  1. Android入门(八) | 常用的界面布局 及 自定义控件

    文章目录 LinearLayout :线性布局 android:layout_gravity :控件的对齐方式 android:layout_weight:权重 RelativeLayout :相对布 ...

  2. Android 仿PhotoShop调色板应用(三) 主体界面绘制

    版权声明:本文为博主原创文章,未经博主允许不得转载. Android 仿PhotoShop调色板应用(三) 主体界面绘制    关于PhotoShop调色板应用的实现我总结了两个最核心的部分:   1 ...

  3. Android ViewPager和Fragment实现顶部导航界面滑动效果

    在项目中,我们常常需要实现界面滑动切换的效果.例如,微信界面的左右滑动切换效果.那这种效果是怎么实现的?今天我就带大家简单了解ViewPager,并通过实例来实现该效果. 一. ViewPager 官 ...

  4. Android应用开发:数据存储和界面展现-1

    1. 相对布局RelativeLayout 特点:相对布局所有组件可以叠加在一起:各个组件的布局是独立的,互不影响:所有组件的默认位置都是在左上角(顶部.左部对齐) 属性 功能描述 android:l ...

  5. android 自启动列表,Android 机型设置自启动的跳转界面

    Android 机型设置自启动的跳转界面 由于之前版本号把23,6.0误写成26,8.0了,导致一些判断是错的,并且在catch中没有重新对intent更新,导致会有崩溃问题,现已修复. 简书怎么传附 ...

  6. Android软件开发之盘点自定义View界面大合集(二)

    Android软件开发之盘点自定义View界面大合集(二) - 雨松MOMO的程序世界 - 51CTO技术博客 雨松MOMO带大家盘点Android 中的自定义View界面的绘制 今天我用自己写的一个 ...

  7. android 悬浮按钮 魅族,Android使用RecycleView实现魅族手机通讯录界面

    原标题:Android使用RecycleView实现魅族手机通讯录界面 本文作者 本文由_小马快跑_投稿. _小马快跑_的博客地址: http://www.jianshu.com/u/18502855 ...

  8. Android和iPhone应用程序界面布局示例

    下图是根据Android和iPhone这两个平台的"生产内容型的应用程序"整理出来的界面布局示例.所对比的4个点,均是两大平台的应用程序常规界面元素.   状态栏: Android ...

  9. Android对弹出输入法界面影响app界面布局

    Android中弹出输入法界面不影响app界面布局 默认情况下,输入法弹出的时候,原来的view会被挤扁.有些应用不想被挤,它们可以接受被输入法view覆盖在上面.这时候需要在AndroidManif ...

最新文章

  1. Matlab画图,去掉周围白边
  2. 你不是在拯救世界就是在拯救世界的路上
  3. WPF保存包含Winform控件的XAML页面问题
  4. 安装 SAP Spartacus 3.0 并使用B2B功能
  5. 【线段树】Optimal Insertion(CF751E)
  6. 自定义控件常用方法总结
  7. 浏览器html5视频抓取,检测浏览器是否支持html5视频的代码
  8. mexcuda中矩阵数据的传输
  9. 拒绝:请求的对资源的访问被拒绝:泊坞窗
  10. 编译doubango时,ffmpeg先用 2.8.15,再用4.2.2
  11. ks检验正态分布结果_SPSS实现Shapiro-Wilk正态分布检验
  12. 参考文献格式、论文尾注
  13. 51c语言延时程序怎么编写,C51中延时程序的编写
  14. 蓝队攻击的四个阶段(二)
  15. 对于跨境电商系统的介绍
  16. 《数据清洗》——kettle基本工具的使用
  17. UserAgent和获取手机内安装的所有app列表
  18. CityMaker研修之路 02 伟景行(CityMaker)的倾斜之路
  19. python便携版本_python便携版安装tk
  20. Word粘贴快捷键不能用

热门文章

  1. 0基础怎么学习短视频剪辑,并通过剪辑赚钱?
  2. 差模干扰/电压/电流/电感/电容与共模干扰/电压/电流/电感/电容的介绍
  3. 面试中C语言常问问题(含答案)
  4. vue对比两段json文本修改,修改的项添加红色高亮显示
  5. 高匿ip代理工具的特殊功能?
  6. 正交投影变换与透视投影
  7. 极客云上使用anaconda配置python2.7+tensorflow1.8
  8. kali mysql停止服务器_MySQL主从复制配置详解
  9. Vue3通过axios来读取本地json文件
  10. 刷脸支付设备深度融合多项赋能