- 浏览: 412850 次
- 性别:
- 来自: 上海
-
文章分类
- 全部博客 (397)
- 随笔 (2)
- java (44)
- android (129)
- html + css (18)
- php (35)
- linux (2)
- html5技术/游戏 (3)
- 其他 (30)
- MAC (2)
- IOS (11)
- mongoDB (0)
- js + jquery (29)
- SQL (5)
- ecshop (2)
- jsp (1)
- mybatis (1)
- 推荐 (0)
- 网络推广 (1)
- jquery mobiles (7)
- Sencha Tcouch (11)
- case (2)
- joomla (1)
- cocos2d (1)
- AndEngine (1)
- 错误异常报错 (1)
- 第三方&二次开发 (5)
- cordova (5)
- swift (81)
- mysql (1)
- zepto (2)
- 常用代码 (1)
最新评论
-
wu1238:
2c2ab98030fc767cf89051f369a97c5 ...
Swift -> UILable 设置内边距 UIEdgeInsets , UITextField 设置内边距
contrl_index_top_bar_bg.xml
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/contrl_top_bar_bg" android:tileMode="repeat" />
调用
<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="9" android:background="@drawable/contrl_index_top_bar_bg" > </RelativeLayout>
实际上在 android 中, 即便 直接
android:background
=
"@drawable/contrl_top_bar_bg"
也可以达到效果,
区别是, 直接 加载图片 为背景会将 图片 以一定比例 显示完整即会被拉伸, 加载 style 的话则 以原有布局的大小不变,图片
大小不变 镶嵌其中,会出现repeat效果类似 HTML 里面的 CSS 背景图片


发表评论
-
android -> ImageButton 内部图片 padding
2020-04-09 12:00 471先给 ImageButton 设置属性 andr ... -
android -> 设置 全局 字体样式
2017-05-05 11:11 767首页在AndroidManifest.xml中 ap ... -
android -> 背景background - shape的使用
2017-05-04 12:09 933shape用于设定形状,可以在selector, ... -
android -> 只保留一边 的 边框 border
2017-05-03 09:05 1092设置background <layer-li ... -
android -> 在布局中动态添加view的两种方法
2017-04-29 19:48 1023转自 : http://b ... -
android -> 修改 version 版本
2017-03-28 15:33 442除了在 manifest.xml 里面 <?xml ... -
android -> viewPaer 页面滑动
2017-03-27 17:23 578MainActivity.java public ... -
android -> 获取系统输入法列表/已勾选/默认
2017-03-26 13:02 1224参考: http://www.aichengxu. ... -
android -> android 一个 textview 设置不同的字体大小和颜色
2017-03-24 00:05 916参考: http://blog.csdn.net/fengy ... -
android -> 查看 签名 的 信息 包括 有效期
2017-03-23 11:27 1074C:\Windows\system32>D ... -
android -> 父控件 遍历 子 控件
2017-03-21 21:03 752布局文件: <LinearLayout an ... -
android -> 动画类( Animation)
2017-03-19 11:01 561参考: https://my.oschina.net/u/ ... -
android -> TextView setTextSize(int unit, float size) -- px,sp,dip
2017-03-18 23:35 1097TextView setTextSize(int unit, ... -
android -> canvas学习3 (跟随手势画直线)
2017-03-10 17:17 958DiyView.java package com ... -
android -> canvas学习2(动态画图)
2017-03-10 16:31 630关键字 invalidate() 重新执行onDra ... -
android -> canvas学习1
2017-03-10 14:39 520参考: http://blog.csdn.net/lee5 ... -
android -> 九宫格 划直线解锁
2017-03-09 22:53 463来自 : http://blog.csdn.net/ ... -
android -> 按钮 圆角 & 边框 & 渐变
2017-02-14 16:32 941参考: http://blog.csdn.net/l ... -
android -> 资源文件 反编译
2017-02-14 15:30 441官方网站 : https://ibotpeaches ... -
android -> 按钮双击
2017-02-12 11:48 497long space_last_click_time; ...
相关推荐
渐变背景主要通过`<gradient>`标签在XML资源文件中定义,该标签位于`<shape>`标签内部,属于Android图形资源的一部分。`<gradient>`支持多种属性设置,如开始颜色(`android:startColor`)、结束颜色(`android:...
android:background="@drawable/gradient_background"> <!-- 布局元素 --> </LinearLayout> ``` #### 三、灵活使用`styles.xml` 通过使用`styles.xml`文件,可以更好地管理应用程序的主题和样式,提高代码的可...
<item name="android:background">@drawable/btn_border</item> </style> <!-- 布局文件 --> android:id="@+id/button_bordered" android:layout_width="wrap_content" android:layout_height="wrap_content" ...
`android:background="@drawable/sswj"`用于设置背景图片,而`android:gravity="right|bottom"`则表示所有子视图将被放置在布局的右下角。 在LinearLayout内部,我们通常会包含多个子视图,如TextView、ImageView等...
android:background="@drawable/badge_background" /> </merge> ``` 接下来,我们需要处理动态更新数字的部分。这通常涉及到监听消息或者通知的数量,并在数量改变时更新TextView的文本。在Java或Kotlin代码中,...
在布局文件中,可以使用`<android.widget.Button>`或`<com.example.CustomButton>`(如果自定义了类)标签来创建一个按钮,并通过`android:background`属性设置背景图片。例如: ```xml android:id="@+id/...
android:background="@android:color/white" /> android:id="@+id/ll_operation" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:...
然而,这种方法在多分辨率和动态尺寸的Android环境中并不理想,因为我们需要为不同尺寸的设备准备多个背景图片。 另一种常见方法是使用Shape Drawable,这是一种XML资源,允许我们定义形状(如矩形、椭圆等)并为其...
android:background="@drawable/bottom_bar"> android:id="@+id/bottombae" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> android:id="@...
android:background="@drawable/frame_animation" /> ``` 5. **注意事项** - 确保所有的帧图片尺寸相同,以避免在播放动画时出现缩放或拉伸的问题。 - `duration`属性的值决定了动画的流畅度,数值越小,动画...
android:background="@drawable/gradient_bg"> <!-- 其他布局元素 --> </LinearLayout> ``` #### 3. 灵活使用`styles.xml` 在Android应用开发中,`styles.xml`文件用于定义整个应用程序或某个特定组件的样式,...
android:background="@drawable/frame_animation" /> ``` 4. **启动和控制动画**:在Activity或Fragment的代码中,获取到`AnimationDrawable`对象,并调用`start()`方法开始动画。要停止动画,可以调用`stop()`...
android:background="@anim/frame_animation" /> ``` 4. **启动和控制动画**:在Activity或Fragment的代码中,获取`AnimationDrawable`对象并启动或停止动画。 ```java ImageView imageView = findViewById(R....
<item name="android:background">@drawable/button_shape</item> <item name="android:textSize">18sp</item> </style> <!-- layout.xml --> android:layout_width="wrap_content" android:layout_height=...
1. **XML布局文件**:在XML布局文件中,可以通过`android:background`属性直接设置元素的背景颜色。例如,对于一个LinearLayout,可以这样写: ```xml xmlns:android=...
android:background="@drawable/animation_list" /> ``` 最后,在Activity的`onCreate()`方法中: ```java ImageView imageView = findViewById(R.id.animation_view); AnimationDrawable frameAnimation = ...
需要调整该布局,去除内边距(`android:padding="0dp"`),并将背景色设为白色(`android:background="@android:color/white"`或`android:background="#FFFFFF"`,取决于使用的API版本)。 3. **添加ImageView**: - 向...
android:background="@color/titlebar_bg"> android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/gafricalogo"/> </FrameLayout> ``` #### 三、动态加载视图 ...
在Android开发中,9.png(也称为9-patch或九宫格图片)是一种特殊格式的图像,用于创建可自适应内容大小的UI元素,如按钮、背景等。它允许开发者指定图片的哪些部分应该拉伸,哪些部分应保持不变,以确保在不同尺寸...