In my Android app I have set up a common footer for all activity.
Implemented like this How do I create a header or footer button bar for my Android application with a top most Activity "MyActivity".
In my other activity I code as:
public class TestActivity extends MyActivity implements OnClickListener {
private static final String TAG = "TEST";
private AlertDialog.Builder builder = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
// Pick up the group from head_foot.xml for middle data to be displayed
ViewGroup vg = (ViewGroup) findViewById(R.id.lldata);
ViewGroup.inflate(Mumbai77Activity.this, R.layout.main, vg);
In other activity, child of MyActivity where I create an AlertDialog thru Inflate Layout and display, the height of AlertDialog should be less than the height reached footer. How do I handle the height of the AlertDialog.
The code I use for creating dialog is :
public AlertDialog createAlertDialog(String title, String[] items, OnItemClickListener clickListener) {
LayoutInflater layoutInflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// scrollview1 is the root of this activiy layout
ViewGroup vg = (ViewGroup) findViewById(R.id.scrollView1);
LinearLayout view = (LinearLayout) layoutInflater.inflate(R.layout.gen_list_layout, vg, false);
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_height="wrap_content" android:id="@+id/scrollView1"
android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
I tried setting LayoutParams in AlertDialog for the Viewgroup, but it also didn't work.
How to make the AlertDialog's height same as scrollview's or lldata's height?