0

I have requirement of creating two activities and their layout programmatically. And I want to create something like this,

Create a first activity and with a fixed background and second activity which will have a transparent area at all side so there the view of first activity will be shown.

Right now I am creating one activity and it shows OK. and setTheme( android.R.style.Theme_Translucent ); when i open second activity the view shows with margin but with the plain background and not the transparent view of first activity.

I have set the back ground of second activity like this, rLayout.setBackgroundColor(Color.parseColor("#80000000")); It is showing the grey color at background.

I know a one work around by creating dialog, But it would be better to use activity as per our requirement.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Hardik Chauhan
  • 2,750
  • 15
  • 30
  • In place of sencond activity you have to use fragment . – Rahul Oct 01 '15 at 04:45
  • ok thanks for fast reply, I will look for that. But still if there is any way to do it by activity, It will be very nice if its possible. – Hardik Chauhan Oct 01 '15 at 04:51
  • I think you can try this http://stackoverflow.com/questions/11562051/change-activitys-theme-programmatically – Ramz Oct 01 '15 at 05:49

1 Answers1

0

You can create a transparent theme in styles and then use that style for your transparent Activity.

Refer to this answer: How do I create a transparent Activity on Android?

Community
  • 1
  • 1
pgiitu
  • 1,671
  • 1
  • 15
  • 23
  • See i have to create a whole layout programmatically without using any layout xml. so my concern is that 'is it possible to create style programmatically?' cause i found some answer in stackoverflow that it is not possible. – Hardik Chauhan Oct 01 '15 at 05:04