android 代码动态控制 edittext 高度
dm=newDisplayMetrics();getActivity().getWindowManager().getDefaultDisplay().getMetric...
dm = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
edit_params = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
edit_params.bottomMargin=8;
setEtContentHeight();
edit_problem_reson_send_msg_content.setLayoutParams(edit_params);
private void setEtContentHeight(){
if(edit_problem_reson_send_msg_content.getHeight()==dm.widthPixels /4){
edit_params.height=LayoutParams.WRAP_CONTENT;
}else{
edit_params.height=dm.widthPixels /4;
}
} 展开
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
edit_params = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
edit_params.bottomMargin=8;
setEtContentHeight();
edit_problem_reson_send_msg_content.setLayoutParams(edit_params);
private void setEtContentHeight(){
if(edit_problem_reson_send_msg_content.getHeight()==dm.widthPixels /4){
edit_params.height=LayoutParams.WRAP_CONTENT;
}else{
edit_params.height=dm.widthPixels /4;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询