【问题标题】:Auto triggering of google PlaceAutocompleteFragmentgoogle PlaceAutocompleteFragment 的自动触发
【发布时间】:2016-08-11 14:05:43
【问题描述】:
<fragment
     android:id="@+id/place_autocomplete_fragment"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"/>

我正在阅读片段

PlaceAutoCompleteFragment fromCity = (PlaceAutocompleteFragment)getFragmentManager().findFragmentById(R.id.source);

查看目的地ClearView = fromPlace.getView().findViewById(R.id.place_autocomplete_clear_button);

但是 destinationClearView.setVisibility(View.INVISIBLE) 不起作用,如何实现?

【问题讨论】:

  • 尝试更详细。
  • PlaceAutoCompleteFragment fromCity = (PlaceAutocompleteFragment)getFragmentManager().findFragmentById(R.id.source); fromCity.setHint(getString(R.string.your_location)); fromCity.setOnPlaceSelectedListener(new PlaceSelectionListener() { Override public void onPlaceSelected(Place place) { //对 place 做一些事情 } Override public void onError(Status status) { //对错误做一些事情 } });在这里,我想以编程方式单击该小部件
  • @PřemyslŠťastný 以及当用户通过单击清除图标清除该地点时如何获得回调
  • @PřemyslŠťastný 我正在通过destinationClearView = destinationWidget.getView().findViewById(R.id.place_autocomplete_clear_button) 访问清晰视图;我添加了 onclick 监听器,因为我必须做一些功能,但它不是在清除文本的父片段中执行方法,隐藏 clearbutton 我该如何实现?
  • 写(编辑)它来提问,它会再次抛出系统。你会得到更好的答案。 :)

标签: android google-maps autocompletetextview


【解决方案1】:

这不是好方法,但它是工作。

View close = viewOfFragment.findViewById(R.id.place_autocomplete_clear_button);
ViewsUtils.setVisible(false, close);
lp = (LinearLayout.LayoutParams) close.getLayoutParams();
lp.height = 1;
lp.width = 1;
close.requestLayout();

【讨论】:

    猜你喜欢
    • 2023-03-08
    • 1970-01-01
    • 2016-02-24
    • 2017-03-28
    • 2014-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多