The substrate that the headliners are made of for these trucks come in 2 variations. Cardboard, or a pressed fiber that looks like fiberglas. Either one will soak up paint or dye like a sponge. Neither will look good.
Do as you suggested by scraping the cruddy foam off, (Easy to do) then pick up some real headliner material from an upholstery shop or supplier, along with a can of 3M '90' spray glue. Or 3m '76'. Avoid what's called 'Feather spray' glue. It's crap!
The H/L fabric is 54" wide & it does have some stretch to it. Don't know if this is for your reg. cab or the extended one, but knowing how wide the fabric is will make it easy for you to figure how much you need. Don't let the place you're buying the fabric from try to sell it to you by the square yard, a common trick to darn near triple their profit. It's supposed to be sold by the linear yard. 54" X the measurement up the roll.
Lay the material over the headliner, foam side to H/L, leaving about 6-8" of extra material all around, then fold it back in half over it self. Spray the glue on the foam side of the fabric, & the H/L panel. Not so much that it soaks the material, but a nice even coat. Let dry till tacky. Start from the center & work the material down on to the panel. The problem areas are going to be the corners. This is where the stretch of the material helps. Hold the fabric up off the panel at the corner, & with your other hand slowly attach the fabric while slightly pulling the material with your hand holding the fabric at the corner. By slightly pulling in one direction or the other as you push the material down, you can work out any wrinkles that want to form. Fold the other side over the glued down portion & repeat.
Once the fabric is on the H/L panel, put an old blanket on the bench & flip the H/L over and spray the edges of the extra material hanging over there. Let dry till tacky & start wrapping the material to the back side. Cut reliefs to allow the material to fit where the panel curves. Not too close to the panel. about a 1/2" away from it. If the material still gets tight, don't cut the reliefs deeper, cut more reliefs. Where the material wants to bunch up, don't worry about that too much, just push it together, then cut that bunched material after the edges are all wrapped. Cut out any holes that are required, such as for visors & handles etc. from the backside of the H/L.
I've installed these in the truck by myself, but it ain't fun. Somebody helping just hold it in place while you start installing really helps. make sure that any wiring for lights, lighted visors, overhead consoles, etc. are through the H/L before you completely button everything up. The less you mess with the H/L at this point, the less chance of it getting screwed up.
Post up any Q's that you need help with. Good luck! AL.