Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make layout's and view's background transparent?
    primarykey
    data
    text
    <p>I'm trying to make a layout with a background and add a scroll view at the bottom of this layout.</p> <p>here's my code:</p> <pre><code>FrameLayout mainLayout = new FrameLayout(getApplicationContext()); mainLayout.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); mainLayout.setBackgroundResource(R.drawable.background2); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, 200); params.gravity = Gravity.BOTTOM|Gravity.CENTER; final ScrollView scrollView = new ScrollView(getApplicationContext()); scrollView.setLayoutParams(params); scrollView.setBackgroundColor(Color.TRANSPARENT); StorageView storageView = new StorageView(getApplicationContext()); storageView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); Drawable drawable = getResources().getDrawable(R.drawable.background1); drawable.setAlpha(0); storageView.setBackgroundDrawable(drawable); scrollView.addView(storageView); mainLayout.addView(scrollView); setContentView(mainLayout); </code></pre> <p>why I see only the background image?</p> <p>*Edit:</p> <p>If I remove all the setBackgroundColor and move the setBackgroundDrawable to the ScrollLayout or the StorageView I see the background on the whole screen</p> <p>*Edit2:</p> <p>I edit the code: I remove the unnecessary layouts, and set a background drawable with alpha set to 0, and now it works.</p> <p>well, I'll be happy if someone explain to me why I need to do this? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload