Android中不用图片资源也能做出好看的界面
来源:互联网 发布:淘宝女装皇冠店铺排行 编辑:程序博客网 时间:2024/04/30 00:06
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
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
shape
xmlns:android
=
"http://schemas.android.com/apk/res/android"
android:shape=["rectangle" | "oval" | "line" | "ring"] >
<
corners
android:radius
=
"integer"
android:topLeftRadius
=
"integer"
android:topRightRadius
=
"integer"
android:bottomLeftRadius
=
"integer"
android:bottomRightRadius
=
"integer"
/>
<
gradient
android:angle
=
"integer"
android:centerX
=
"integer"
android:centerY
=
"integer"
android:centerColor
=
"integer"
android:endColor
=
"color"
android:gradientRadius
=
"integer"
android:startColor
=
"color"
android:type=["linear" | "radial" | "sweep"]
android:useLevel=["true" | "false"] />
<
padding
android:left
=
"integer"
android:top
=
"integer"
android:right
=
"integer"
android:bottom
=
"integer"
/>
<
size
android:width
=
"integer"
android:height
=
"integer"
/>
<
solid
android:color
=
"color"
/>
<
stroke
android:width
=
"integer"
android:color
=
"color"
android:dashWidth
=
"integer"
android:dashGap
=
"integer"
/>
</
shape
>
ring环形值描述android:topRightRadius右上角android:bottomLeftRadius右下角android:topLeftRadius左上角
android:bottomRightRadius左下角
android:useLevel=["true" | "false"] />
android:type="radial"
.)startColor开始颜色typeuseLevel设置资源管理的画板(不是很懂。。。)值描述width描边的宽度color描边的颜色dashWidth一个虚线"-"的宽度dashGap一个虚线"-"的隔开距离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"
?>
<
LinearLayout
xmlns:android
=
"http://schemas.android.com/apk/res/android"
android:layout_width
=
"fill_parent"
android:layout_height
=
"wrap_content"
android:background
=
"@android:color/transparent"
android:orientation
=
"vertical"
>
<
LinearLayout
android:layout_width
=
"250dp"
android:layout_height
=
"wrap_content"
android:background
=
"@drawable/fragment_logout_button_backgroud_normal"
android:orientation
=
"vertical"
>
<
LinearLayout
android:layout_width
=
"fill_parent"
android:layout_height
=
"100dp"
android:orientation
=
"vertical"
>
<
TextView
android:id
=
"@+id/oneBtnInfo"
android:layout_width
=
"fill_parent"
android:layout_height
=
"40dp"
android:layout_margin
=
"2dp"
android:background
=
"@drawable/exit_bg"
android:gravity
=
"center"
android:text
=
"提示信息"
android:textColor
=
"#fff"
android:textSize
=
"20sp"
/>
<
TextView
android:id
=
"@+id/tishiInfo"
android:layout_width
=
"fill_parent"
android:layout_height
=
"wrap_content"
android:layout_marginTop
=
"20dp"
android:gravity
=
"center"
android:text
=
"确定要退出?"
android:textColor
=
"#000"
android:textSize
=
"18sp"
/>
</
LinearLayout
>
<
LinearLayout
android:layout_width
=
"fill_parent"
android:layout_height
=
"50dp"
android:layout_margin
=
"2dp"
android:background
=
"@color/gray_light"
android:gravity
=
"center"
android:orientation
=
"horizontal"
android:padding
=
"5dp"
>
<
Button
android:id
=
"@+id/exit_btn"
android:layout_width
=
"fill_parent"
android:layout_height
=
"35dp"
android:layout_margin
=
"5dp"
android:layout_weight
=
"1"
android:background
=
"@drawable/fragment_logout_button_selector"
android:text
=
"确定"
android:textColor
=
"@color/black"
/>
<
Button
android:id
=
"@+id/cancel_btn"
android:layout_width
=
"fill_parent"
android:layout_height
=
"35dp"
android:layout_margin
=
"5dp"
android:layout_weight
=
"1"
android:background
=
"@drawable/fragment_logout_button_selector"
android:text
=
"取消"
android:textColor
=
"@color/black"
/>
</
LinearLayout
>
</
LinearLayout
>
</
LinearLayout
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
shape
xmlns:android
=
"http://schemas.android.com/apk/res/android"
>
<
gradient
android:angle
=
"270"
android:centerColor
=
"@color/blue"
android:endColor
=
"@color/blue"
android:startColor
=
"@color/blue"
android:type
=
"linear"
/>
<
stroke
android:width
=
"0.5dp"
android:color
=
"@color/blue"
/>
<
corners
android:radius
=
"2dp"
android:topLeftRadius
=
"5dp"
android:topRightRadius
=
"5dp"
android:bottomLeftRadius
=
"0dp"
android:bottomRightRadius
=
"0dp"
/>
</
shape
>
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
package
com.zhf.android_dialog_shape;
import
com.zhf.android_dialog_shape_theme.R;
import
android.os.Bundle;
import
android.app.Activity;
import
android.app.AlertDialog;
import
android.view.View;
import
android.view.View.OnClickListener;
import
android.view.Window;
import
android.widget.Button;
/**
* 测试自定义的Dialog(使用到了Shape Drawable)
* @author ZHF
*
*/
public
class
MainActivity
extends
Activity {
private
AlertDialog alertDialog;
private
Button button;
@Override
protected
void
onCreate(Bundle savedInstanceState) {
super
.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button)
this
.findViewById(R.id.button);
button.setOnClickListener(
new
OnClickListener() {
@Override
public
void
onClick(View v) {
loadExitDialog();
}
});
}
/**弹出自定义对话框**/
private
void
loadExitDialog() {
alertDialog =
new
AlertDialog.Builder(
this
).create();
alertDialog.show();
Window window = alertDialog.getWindow();
window.setContentView(R.layout.exit_dialog);
Button exit_btn = (Button) window.findViewById(R.id.exit_btn);
Button cancel_btn = (Button) window.findViewById(R.id.cancel_btn);
exit_btn.setOnClickListener(
new
OnClickListener() {
@Override
public
void
onClick(View v) {
finish();
}
});
cancel_btn.setOnClickListener(
new
OnClickListener() {
@Override
public
void
onClick(View v) {
alertDialog.dismiss();
}
});
}
}
0 0
- Android中不用图片资源也能做出好看的界面
- ios霓虹灯效果(没基础也可以做出好看的霓虹灯)
- Swing能做出如此强大的界面?你信不信?
- IOS快速删除项目工程中不用的图片资源
- 清理iOS项目中不用的图片资源方法
- LiveAndroid - 不用买手机也能体验 Android 系统
- 如何做出有厚度的 APP 界面图片?
- 不用关闭Windows 7的“UAC”也能安静
- 不用防火墙也能阻止那些讨厌的网站
- 不用游标也能遍历记录的sql语句实例
- Linux_Mysql,不用mysqldump也能导出导入数据的办法。
- 不用设置selector也能更改View的显示状态
- android中如何快速查找不用的资源
- 清理 iOS 项目不用的图片资源
- 清理 iOS 项目不用的图片资源
- 让工作节奏慢一点, 再简单的工作也能做出大成就
- Android 好看的搜索界面,大赞Animation
- Android中内置的图片资源
- 常用命令+快捷键
- 史上最简单win下搭建android+cocos2d环境(包括ndk9)
- C#的dictionary使用总结
- 等号重构(operator=)函数中应该注意的问题
- 【阅读】《Head First HTML 与 CSS》第五章——为你的页面增加图像
- Android中不用图片资源也能做出好看的界面
- WordPress提速优化篇:清理HEAD头部多余脚本
- 顶点间最短路径求解
- DP计算最大和HDU1003
- 用了牡蛎王,老公满血复活又坚挺起来了
- Mac使用Macports安装软件
- 用了牡蛎王,老公满血复活又坚挺起来了
- outlook 关闭时最小化到任务栏的完美解决方法
- 用了牡蛎王,老公满血复活又坚挺起来了