【问题标题】:Show a fragment on a Dialog Fragment or Popupwindow from a FragmentActivity在 FragmentActivity 的 Dialog Fragment 或 Popupwindow 上显示片段
【发布时间】:2014-08-18 10:43:32
【问题描述】:

我的表情符号有这段代码,如果用户点击表情符号徽标,我想显示它。我无法在键盘之间进行切换,因此我正在这样做。

//R.layout.popup_item

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:emojicon="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context="com.rockerhieu.emojicon.example.MainActivity$PlaceholderFragment" >

<com.rockerhieu.emojicon.EmojiconTextView
    android:id="@+id/txtEmojicon"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>

<com.rockerhieu.emojicon.EmojiconEditText
    android:id="@+id/editEmojicon"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    emojicon:emojiconSize="28sp" />

<fragment
    android:id="@+id/emojicons"
    android:layout_width="fill_parent"
    android:layout_height="220dp"
    class="com.rockerhieu.emojicon.EmojiconsFragment" />

当我尝试使用下面的代码为该布局充气时,它显示重复片段错误,这意味着充气错误。任何人都可以建议,如何从 FragmentActivity 膨胀该视图,

 View popUp = getLayoutInflater().inflate(R.layout.popup_item, null);
            window = new PopupWindow(getApplicationContext());
            window = new PopupWindow(popUp,LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,true);
            window.setAnimationStyle(android.R.style.Animation_Activity);
            window.showAtLocation(popUp, Gravity.BOTTOM, 0, 0);
            window.setFocusable(true);
            window.setOutsideTouchable(true);

【问题讨论】:

    标签: android android-layout android-fragments android-dialogfragment android-popupwindow


    【解决方案1】:

    你可以使用我的图书馆:https://github.com/ankushsachdeva/emojicon 这会在软键盘上显示一个带有表情符号的弹出窗口

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-16
      • 2015-01-22
      • 2013-02-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-15
      • 1970-01-01
      相关资源
      最近更新 更多