2

I'm extending a linear layout wich contains 2 TextView. The TextViews are inflated from template layouts I created. My problem is that the backgrund that I set is covering the entire raw, instead only the part that contains text. But, when I'm setting the same layout not in the dynamic way then it is all working and clipping well.

        final LayoutInflater inflater = LayoutInflater.from(this.getContext());

    //The title.
    title = (TextView)inflater.inflate(R.layout.text_view_day_title, null);
    title.setText("bla bla");

    //The info.
    info = (TextView)inflater.inflate(R.layout.text_view_day_info, null);
    info.setText("bla bla 2");

    this.addView(title);
    this.addView(info);

Thanks for helping.

dvircn
  • 357
  • 2
  • 5

1 Answers1

0
  • Make a linear layout inside your xml and addview on it.
  • Make sure that inflated xml has no background background and it has margins between them to show the background of the main xml layout.
Yousef Zakher
  • 1,634
  • 15
  • 18