小编Hig*_*y62的帖子

从BackStack返回片段后,Android ViewPager无法正常显示

我有一个ViewPager设置,它使用片段显示我可以循环的不同图标,以便用户可以导航不同的菜单选项.

ViewPager中的每个项目都位于片段中,如下所示:

public static Fragment newInstance(MainHandheldActivity context, int pos)
{
    Bundle b = new Bundle();
    b.putInt("pos", pos);
    return Fragment.instantiate(context, ObjectFragment.class.getName(), b);
}

@Override
public View onCreateView(LayoutInflater inflater,
                         ViewGroup container, Bundle savedInstanceState) {

    // Get menu image icons
    int icons[] = new int[3];
    icons[0] = R.mipmap.ic_text;
    icons[1] = R.mipmap.ic_voice;
    icons[2] = R.mipmap.ic_mail;

    // Get root view of the fragment layout
    LinearLayout rootView = (LinearLayout) inflater.inflate(
            R.layout.fragment_collection_object, container, false);
    Bundle args = getArguments();
    int pos = args.getInt("pos");

    // Set the current menu …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-viewpager

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

如何使用PHP提取解码的JWT Web令牌的有效载荷数据

我有一个Web令牌,它可以解码为以下内容:

{
 typ: "JWT",
 alg: "HS256"
}.
{
 iat: 1435688301,
 iss: "localhost",
 data: {
  user_id: 2
 }
}.
[signature]
Run Code Online (Sandbox Code Playgroud)

我将其存储在变量$ data中,并且不知道如何访问“ iat”值或“ user_id”。谁能帮我吗?

我试过了

$issuanceDate = $data['iat'];
Run Code Online (Sandbox Code Playgroud)

但这似乎不起作用。我也需要用户ID,但这嵌套在$ data.data中。

任何帮助将不胜感激,谢谢。

php json jwt

3
推荐指数
1
解决办法
4166
查看次数

无法在Android中更改ActionMode背景颜色

我的ActionMode菜单显示为纯白色,我不知道为什么.我有一个ActionMode menu.xml,它只有一个删除选项:

<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:id="@+id/action_delete"
          android:title="Delete"
          android:icon="@android:drawable/ic_menu_delete"/>

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

我有一个主题应用于我的整个应用程序,在styles.xml中定义:

<resources>

    <!-- Base application theme -->
    <style name="AppTheme" parent="Theme.AppCompat.Light">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/paletteLightBlue3</item>
        <item name="colorPrimaryDark">@color/dark_grey</item>
        <item name="colorAccent">@color/paletteLightBlue</item>
        <item name="android:actionModeStyle">@style/aModeBg</item>
    </style>

    <style name="aModeBg" parent="@style/Widget.AppCompat.ActionMode">
        <item name="android:actionModeBackground">@color/dark_red</item>
    </style>

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

正如您所看到的,我已经尝试将actionModeBackground属性设置为深红色,但它仍然只显示为白色.有人可以帮忙吗?谢谢.

android android-actionmode android-styles

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