Here is my solution:
My XML file which the first activity. After clicking on the button you will be redirected to the second activity which has a button. I am giving the complete source code:
Activity 1:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button nextBtn = (Button)findViewById(R.id.button1);
nextBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
startActivity(new Intent("com.ranjan.dibya.shadow.Next"));
}
});
}
}
Activity 2:
public class Next extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.next);
}
}
XML for activity 1:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f09473"
tools:context=".MainActivity" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="16dp"
android:text="Button" />
</RelativeLayout>
XML for Activity 2:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="This is clickable" />
</RelativeLayout>
My Manifest
<activity
android:name=".Next"
android:label="@string/app_name"
android:theme="@style/Theme.MyTranslucent" >
Style:
<style name="Theme.MyTranslucent" parent="android:style/Theme.Translucent">
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.5</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:background">@android:color/transparent</item>
</style>
This works for me. I hope same will work for you.
Edit: The link you followed will result in a transparent activity with the buttons at the center figured this out by myself :)