【发布时间】:2014-02-12 00:32:22
【问题描述】:
我有类似的东西:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/photo1"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/photo2"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</FrameLayout>
<Fragment>
</Fragment>
</FrameLayout>
我想调整 photo2 FrameLayout 的大小。
public void setScreenSize() {
Display display = getWindowManager().getDefaultDisplay();
FrameLayout layout = (FrameLayout) findViewById(R.id.photo2);
int screen_height = display.getHeight();
screen_height = (int) (0.60*screen_height);
LayoutParams parms = (LayoutParams) layout.getLayoutParams();
parms.height = screen_height;
}
不幸的是,这不起作用,我不知道为什么。
【问题讨论】:
-
你找到答案了吗
标签: android height android-framelayout