導航:首頁 > 操作系統 > 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動態改變高度相關的資料

熱點內容
做喊麥需要什麼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
手機看app閃退是什麼問題 瀏覽:692