【问题标题】:Bottom layout hidden in mobile- Android隐藏在移动设备中的底部布局-Android
【发布时间】:2016-02-08 19:12:25
【问题描述】:

我正在设计 android 屏幕,我在所有屏幕中都面临这个问题。我正在使用带有选项卡布局的材料设计。问题是“选项卡布局中屏幕的底部完全隐藏且不可见”。下面是代码,

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

                <RelativeLayout
                    android:id="@+id/rl_reside_immigrants"
                    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:layout_below="@+id/ll_pi_emigrants"
                    android:layout_marginTop="20dp"
                    android:background="@drawable/ex_sum_rounded_corner"
                    android:padding="10dp" >

                    <LinearLayout
                        android:id="@+id/ll_pi_reside_immigrants"
                        android:layout_width="fill_parent"
                        android:layout_height="match_parent"
                        android:layout_below="@id/ll_pi_reside_slt_date"
                        android:layout_marginTop="10dp"
                        android:orientation="horizontal"
                        android:weightSum="3" >

                        <TextView
                            android:id="@+id/tv_residence_entry"
                            android:text="@string/reside_entry" />

                        <View
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight=".2" />

                        <EditText
                            android:id="@+id/dp_residence_entry"
                            android:onClick="selectDate" />

                        <View
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight=".2" />

                        <TextView
                            android:id="@+id/tv_residence_exit"
                            android:text="@string/reside_exit" />

                        <View
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight=".2" />

                        <EditText
                            android:id="@+id/dp_residence_exit"
                            android:onClick="selectDate" />
                    </LinearLayout>
                </RelativeLayout>

                <TextView
                    android:id="@+id/tv_pi_abt_ur_resedence1"
                    android:layout_below="@+id/rl_reside_immigrants"
                    android:layout_marginTop="20dp"
                    android:text="@string/reside_title" />
            </RelativeLayout>
    </ScrollView>

图形布局

构建后的设备屏幕是

在图形布局中,我能够看到正确的屏幕,但在设备中构建相同的屏幕时,图形布局中的红色标记部分隐藏在所有设备中。

需要帮助来解决这个问题。

谢谢

【问题讨论】:

  • 在图形布局中,我可以看到一个黄色的警报符号。您能否检查一下该警告的原因以及 RelativeLayoutandroid:id="@+id/rl_reside_immigrants" 不是必需的,因为您有两个相对布局。

标签: android android-layout android-fragments


【解决方案1】:

请使用

<Scrollview> 
    <LinearLayout>
        <RelativeLayout>
        **everything else**
        </RelativeLayout>
    </LinearLayout>
</Scrollview>

因为RelativeLayout 不是ScrollView 最好的朋友

【讨论】:

  • 好的,但在图形布局中,屏幕看起来不错。知道为什么构建屏幕后隐藏。
  • 我不使用LinearLayout而不是多余的RelativeLayout,所以你也会获得一些性能优化
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-25
  • 1970-01-01
  • 1970-01-01
  • 2016-04-26
  • 2021-04-12
  • 1970-01-01
相关资源
最近更新 更多