如何在android库的片段内添加Buttons和textView等小部件?

问题描述 投票:-1回答:1

我试图实现像下面的图片,我怎么能做的片段android. libraries.places.widget我试过使用相对布局,但它不显示在地方widget里面,任何人都可以建议一些好的来源来做到这一点,或者有任何其他布局,可以用来做它。

我试过的Xml。

  <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Maps.MapsAddress" >


<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginTop="10dp"
android:id="@+id/autocomplete_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.google.android.libraries.places.
widget.AutocompleteSup   portFragment"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chetpet Chennai"
android:textSize="14sp"
android:id="@+id/toolbar_address">
</TextView>

</FrameLayout>

Like this

android google-maps android-layout android-fragments
1个回答
0
投票

根布局使用:相对

搜索条布局可以使用搜索视图或浮动搜索视图(外部库)。

设备位置可以使用相对布局,所以图标放置在父节点等位置的开始。

保存的地址你可以使用表格布局。

给不同的布局分配id,这样你就可以把布局堆叠在根关系布局里面。

© www.soinside.com 2019 - 2024. All rights reserved.