在我的Android应用中,我为所有活动设置了一个公共页脚。
像How do I create a header or footer button bar for my Android application一样实施了最活跃的“MyActivity”。
在我的其他活动中,我编码为:
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);
在其他活动中,MyActivity的子项我通过Inflate Layout和显示创建AlertDialog,AlertDialog的高度应小于到达页脚的高度。如何处理AlertDialog的高度。
我用于创建对话框的代码是:
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">
我尝试在ViewDialog中为Viewgroup设置LayoutParams,但它也没有用。
如何使AlertDialog的高度与scrollview或lldata的高度相同?