我动态创建了 LinearLayout 并在该布局中设置了可绘制的背景
当该布局空闲时,它看起来不错
问题是当我点击用户名edittext时布局已经分裂
当我单击布局折叠的密码编辑文本时
如果可以解决请给点建议
可绘制:button_shape.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffffff"/>
<corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape>
笔记:
用户名和密码是分开的 LinearLayout
Login和SignUp按钮是分开的LinearLayout;
动态线性布局代码
LinearLayout mainlayout = new LinearLayout(con);
mainlayout.setOrientation(1);
mainlayout.setBackgroundDrawable(drawable);
for(int i=0;i<data.size();i++){
TextView tv = new TextView(con);
EditText et = new EditText(con);
tv.setText(data.get(i));
tv.setHeight(50);
tv.setPadding(22, 0, 0, 0);
tv.setTextColor(0xff000000);
mainlayout.addView(tv);
et.setHint("Tap To Type");
mainlayout.addView(et);
}