小编Sal*_*V S的帖子

如何为包含的布局设置重量?

我有两个xml文件,页眉和页脚,如下所示

header.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#9d1246" >

        <Button
            android:id="@+id/button_backfromreg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp"
            android:background="@drawable/backbtn"
            android:visibility="visible" />
    </LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

footer.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#9d1246" >
    </LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我在mainlayout中包含了上面两个布局,如图所示

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#eaedf2"
    android:orientation="vertical" >

    <include
        android:layout_weight="1"
        layout="@layout/header" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_margin="30dp"
        android:layout_weight="1"
        android:orientation="vertical" >

        <EditText
            android:id="@+id/editText1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:editable="false"
            android:ems="10"
            android:hint="Country"
            android:textColor="#655e5e"
            android:textSize="15sp" >

            <requestFocus />
        </EditText> …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-layout-weight

8
推荐指数
1
解决办法
5140
查看次数

如何从google.maps.places.Autocomplete获得超过5个结果?

在我的应用程序中,我正在显示google.maps.places.Autocomplete视图,该视图集成在Web视图的html页面中。在上面键入时,我仅获得5个下拉结果。如何增加搜索结果?有人请帮忙..

android google-maps autocomplete

5
推荐指数
1
解决办法
2294
查看次数