转载请标明出处:http://blog.csdn.net/xx326664162/article/details/51331694 文章出自:薛瑄的博客
你也可以查看我的其他同类文章,也会让你有一定的收货!
在java代码中加载view,如何控制view的大小和填充方式呢??
LayoutParams 之控制填充方式
问题:
有个LinearLayout,用来动态加载别的view页面,EditText的宽度是由里面的内容决定 ,无法显示为match_parent的效果
想要的效果:EditText能以match_parent的width来显示。
布局文件:
main 布局:
<?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="fill_parent" android:background="#fff" android:orientation="vertical" > <LinearLayout