I certainly hope you're actually not storing dates as integers, but since your example data implies that, I have made my solution accordingly.
WITH avgview AS (
SELECT user_id
,date
,login_count
,Avg(login_count) OVER (PARTITION BY user_id) avgcount
FROM VIEW
)
SELECT *
FROM avgview
PIVOT (
Sum(login_count)
FOR DATE IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31)
)