Нужно, чтобы добавить элементы один под другой из java кода, не используя xml - разметку. Есть код:
//RelativeLayout - mainLayout
RelativeLayout mainLayout = (RelativeLayout) findViewById(R.id.shopLayout);
//RelativeGroup
RelativeLayout groupOfItems = new RelativeLayout(ShopActivity.this);
//Param for group
RelativeLayout.LayoutParams groupParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
groupParam.addRule(RelativeLayout.BELOW);
//Element of all construction
LinearLayout shopLinear = new LinearLayout(ShopActivity.this);
//Item for redacting
EditText note = new EditText(ShopActivity.this);
EditText price = new EditText(ShopActivity.this);
//Params for note
LinearLayout.LayoutParams noteParam = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
noteParam.weight=3;
//Param for price
LinearLayout.LayoutParams priceParam = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
priceParam.weight = 1;
//Param for shopLinear
LinearLayout.LayoutParams shopLayParam = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
//Configuration
//Conf shopLinear
shopLinear.setOrientation(LinearLayout.HORIZONTAL);
shopLinear.setLayoutParams(shopLayParam);
//Conf note
note.setLayoutParams(noteParam);
//Conf price
price.setLayoutParams(priceParam);
//Adding
//Add to shopLinear
shopLinear.addView(note);
shopLinear.addView(price);
//
groupOfItems.setLayoutParams(groupParam);
groupOfItems.addView(shopLinear);
//Add to main
mainLayout.addView(groupOfItems);
Есть такой код, он делает группу RelativeLayout и туда кладет два Едит Текст , так вот , когда я пишу еще один такой же(с другими названиями переменных), то оно не добавляет его под предыдущий,а либо вообще не добавляет, либо добавляет прямо на место этого(скорее всего)
Как вести несколько рекламных аккаунтов в антидетект-браузере
Подготовка и масштабирование рекламных кампаний в среде Linken Sphere