导航:首页 > 操作系统 > android动态改变高度

android动态改变高度

发布时间:2024-07-04 05:17:54

android edittext镞犳硶鏀瑰彉楂桦害

Android锷ㄦ佹敼鍙桢diText鎺т欢澶у皬镄勬柟娉曪细
1銆佸0鏄庢带浠跺弬鏁拌幏鍙栧硅薄 LayoutParams lp锛
2銆佽幏鍙栨带浠跺弬鏁帮细 lp = 鎺т欢id.getLayoutParams();
3銆佽剧疆鎺т欢鍙傛暟锛氩傞珮搴︺ lp.height -= 10;
4:銆佷娇璁剧疆鐢熸晥锛氭带浠籼d.setLayoutParams(lp);
渚嫔傚傝佹妸edittext涓嬬Щ200px锛 edittext.setPadding(
edittext.getPaddingLeft(), ImageView.getPaddingTop()+200, edittext.getPaddingRight(), edittext.getPaddingBottom());

❷ android在代码中设置控件(ScrollView)的高度

一模塌般View像你说的那样便得了,如果那样不行的话可能Scrollview比较特殊一点,我一般都是让饥销ScrollView wrap_content ,然后ScrollView里的布局不要wrap_content,比如里面嵌套一个RelaytiveLayout,这个RelaytiveLayout的旦肢圆高度写死。你代码中设置这个RelaytiveLayout的高度试试能不能满足你的需求

❸ android怎么改变view的高度

这样的思路不太对啊 ,如果需要再添加其他的view最好是把keyboardview和你说的候选栏放在一个layout如LinearLayout 或是RelativeLayout里,再去调整位置和高度等。
getHeight在绘制之前是只会返回0的。如果只是单纯需要重新定义view的高度,最好通过LayoutParams来改变里面的width 和height参数
LayoutParams lp = view.getLayoutParams();
lp.width = 110;
lp.height = 500;
view.setLayoutParams(lp);
view.invidate();

❹ 如何修改 Android 状态栏高度

修改 Android 状态栏高度:
配置文件:frameworks/base/core/res/res/values/dimens.xml

修改条目:

<resources>
<!-- The width that is used when creating thumbnails of applications. -->
<dimen name="thumbnail_width">0dp</dimen>
<!-- The height that is used when creating thumbnails of applications. -->
<dimen name="thumbnail_height">0dp</dimen>
<!-- The standard size (both width and height) of an application icon that
will be displayed in the app launcher and elsewhere. -->
<dimen name="app_icon_size">48dip</dimen>
<dimen name="toast_y_offset">64dip</dimen>
<!-- Height of the status bar -->
<dimen name="status_bar_height">38dip</dimen>
<!-- Height of the status bar -->
<dimen name="status_bar_icon_size">38dip</dimen>
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
<dimen name="status_bar_edge_ignore">5dp</dimen>
<!-- Size of the fastscroll hint letter -->
<dimen name="fastscroll_overlay_size">104dp</dimen>
<!-- Width of the fastscroll thumb -->
<dimen name="fastscroll_thumb_width">64dp</dimen>
<!-- Height of the fastscroll thumb -->
<dimen name="fastscroll_thumb_height">52dp</dimen>
<!-- Default height of a key in the password keyboard -->
<dimen name="password_keyboard_key_height">56dip</dimen>
<!-- Default correction for the space key in the password keyboard -->
<dimen name="password_keyboard_spacebar_vertical_correction">4dip</dimen>
</resources>

❺ android 如何动态设置控件的宽度和高度

一、方法
使用getLayoutParams() 和setLayoutParams()方法
二、示例代码
LinearLayout.LayoutParams linearParams = (LinearLayout.LayoutParams) aaa.getLayoutParams();
// 取控件aaa当前的布局参数
linearParams.height = 365; // 当控件的高强制设成365象素
aaa.setLayoutParams(linearParams); // 使设置好的布局参数应用到控件aaa
三、原理
a)getLayoutParams()和setLayoutParams()都是控件基类view的public方法,在外部也可以直接调用。
b)由于LayoutParams一般是在加入容器中设置的,所以容易混淆所指定的布局属性究竟是保存在容器中,还是控件本身的属性,答案是控件本身。但是在设置时还是要注意布局属性与容器种类密切相关。

阅读全文

与android动态改变高度相关的资料

热点内容
单片机io不够 浏览:444
做喊麦需要什么app 浏览:204
数字信号处理算法的labview实现 浏览:11
复制加密狗还能复制吗 浏览:543
安阳市最大的编程培训学校 浏览:967
androidhttp压缩 浏览:556
联想服务器如何进入阵列卡 浏览:848
拍照文件夹怎么用 浏览:974
公司清算法定代表人章交回本人 浏览:639
xfs为什么不能压缩 浏览:409
获取手机数据源码 浏览:962
迪杰斯特拉算法matlab 浏览:915
迅雷百度云文件解压密码 浏览:464
为什么好多app找不到注销了 浏览:289
javazxing二维码生成 浏览:122
算法递推式 浏览:147
联想加载加密锁失败 浏览:209
赛拉图空调压缩机多少钱 浏览:196
linuxphppdo扩展 浏览:791
如何解决美国服务器网络延迟 浏览:424