【发布时间】:2013-04-04 16:21:33
【问题描述】:
您好,我有一个可以调整大小的布局,但我想同步 3 个不同的线性布局
第一个linearlayout作为header,第二个linearlayout作为leftscrollbar,第三个linearlayout作为内容容器,所以布局会是这样的
____________________________
|_____|____|HEADER___|____|__|
| |____|____|____|____|__|
|_____|____|____|____|____|__|
| | | Content | |
|_____|____|____|____|____|__|
| left|____|____|____|____|__|
|_____| | | | | |
| | |____|____|____|__|
|_____|____|____| |____|__|
| |____|____| |____|__|
|_____|____|____|____|____|__|
标题和左滚动条是可滚动的并与内容同步,所以当我滚动内容时,标题和滚动条也会滚动。但那是另一回事,我已经成功地创造了它。现在我想使用捏添加缩放功能,所以我创建了一个捏视图来检测捏和计算比例,这也完成了。但是现在我想使用我使用 layoutparams 从捏计算的比例来调整布局的大小,但是当我尝试缩放布局时,布局不再匹配。
如您所见,标题的大小和左子大小是静态的,但内容的子视图的大小是动态的,所以我要匹配的是内容单元格的宽度与标题单元格的宽度和高度左栏和内容的高度
这是我的 xml 文件
<niko.twodimensionalscroll.PinchView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pvZoomContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/llContainerMain"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/llHeaderContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/llLeftBarContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</LinearLayout>
<RelativeLayout
android:id="@+id/rlContainerScrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawingCacheQuality="low" >
<niko.twodimensionalscroll.TwoDScrollView
android:id="@+id/tdScrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawingCacheQuality="low" >
<LinearLayout
android:id="@+id/llContainerSchedule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawingCacheQuality="low"
android:orientation="horizontal" >
</LinearLayout>
</niko.twodimensionalscroll.TwoDScrollView>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</niko.twodimensionalscroll.PinchView>
我希望我的问题足够清楚,但如果您需要其他信息,请在评论中提问,我会解释更多
谢谢
【问题讨论】:
-
好把这三个布局放在一个相对的Layout中,
-
所以将我的父视图更改为相对布局?或将 3 布局更改为相对布局?为什么它会影响我的代码?
-
将 3 的父母改为亲戚
-
你能解释一下它会如何影响我的布局吗?也许在答案中?谢谢
标签: android layout android-linearlayout pinchzoom