gpt4 book ai didi

android - Android布局中Pre-kitkat和Post-kitkat版本的不同布局

转载 作者:数据小太阳 更新时间:2023-10-29 02:44:26 24 4
gpt4 key购买 nike

Lollipop 图片: Screenshot from Lollipop

前奇巧: Screenshot from pre Kitkat versions

XML 文件代码:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/backgrounda">


<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/home_round" />


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.16" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.22"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:background="@color/appcolortemp" />
</LinearLayout>
</LinearLayout>


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.28" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.22"
android:gravity="right"
android:orientation="horizontal"
android:weightSum="1">

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:background="@color/appcolortemp" />

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.11" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.51" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.22"
android:gravity="right"
android:orientation="horizontal"
android:weightSum="1">

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:background="@color/appcolortemp" />

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.11" />
</LinearLayout>
</LinearLayout>


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.63" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.22"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:background="@color/appcolortemp" />
</LinearLayout>
</LinearLayout>


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.51" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.22"
android:gravity="left"
android:orientation="horizontal"
android:weightSum="1">

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.11" />

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:background="@color/appcolortemp" />

</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.28" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.22"
android:gravity="left"
android:orientation="horizontal"
android:weightSum="1">

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.11" />

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:background="@color/appcolortemp" />

</LinearLayout>
</LinearLayout>


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.39"></LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.22"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:background="@color/appcolortemp"></LinearLayout>
</LinearLayout>

</LinearLayout>

问题:

Pre-Kitkat 版本中存在一些 UI 问题。在 Pre-Kitkat 版本中,屏幕中间有一条白色 strip 对于 Kitkat 及以上版本,它工作正常。

这段代码有什么问题?我什至无法找出主要原因。

最佳答案

我检查了我的代码并发现了问题。问题出在我的代码中,我有另一个类似于此布局的布局,并且错误地在我的布局中添加了 webview,因此导致了问题。:)

关于android - Android布局中Pre-kitkat和Post-kitkat版本的不同布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33797395/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com