我有这个ScrollView:
if($rowAllImage){
foreach($rowAllImage as $GETimage){
$news->setImage1($_POST[''.$GETimage['name'].'']);
$news->setImage2($_POST[''.$GETimage['name'].'']);
}
}
<input type="checkbox" value="'.$GETimage['name'].'" name="'.$GETimage['name'].'" style="vertical-align: middle;"/></div>
我已经意识到我需要给它一个动态高度,这意味着我需要以编程方式为它做布局。
这是我到目前为止所做的:
<Scrollview
android:id="@+id/DashboardView_menuContainer"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:fillViewport="true" />
所以我只需要以编程方式将_menuContainer = FindViewById < ViewGroup > (Resource.Id.DashboardView_menuContainer);
//get height of screen
var metrics = Resources.DisplayMetrics;
var menuWidth = metrics.WidthPixels;
var menuHeight = metrics.HeightPixels - 200;
//TODO: add anchorBottom to the layoutParams
_menuContainer.LayoutParameters = (new RelativeLayout.LayoutParams(menuWidth, menuHeight));
添加到layour params中。我不确定如何向layoutParams添加任何东西,宽度和高度除外。我该怎么做?
答案 0 :(得分:2)
这应该可以解决问题:
RelativeLayout.LayoutParams parameters = new RelativeLayout.LayoutParams(menuWidth, menuHeight);
parameters.AddRule(LayoutRules.AlignParentBottom);
_menuContainer.LayoutParameters = parameters;