Android的图形页面通过滑动菜单掩盖菜单 [英] Android MapView With Sliding Menu Obscures Menu

查看:185
本文介绍了Android的图形页面通过滑动菜单掩盖菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有地图视图在一个活动Android地图API第2版,使用这种滑动菜单 https://github.com/iPaulPro/SlidingMenu 。除了地图页面上的滑动菜单的伟大工程。有一个黑色的视图覆盖滑动菜单是地图的确切大小。这是与地图高度设置为100dp勾勒出我的意思的例子。

I have a map view for android maps api v2 in an activity that uses this sliding menu https://github.com/iPaulPro/SlidingMenu. The sliding menu works great except for on the map page. There is a black view covering the sliding menu that is the exact size of the map. This is an example with the map height set at 100dp to outline what I mean.

如果我碰那个观点,这会消失。我将如何摆脱它或使其透明?我试过requestTransparentRegion()伎俩。没有骰子在那里。

If I touch that view it will go away. How would I get rid of it or make it transparent? I've tried the requestTransparentRegion() trick. No dice there.

推荐答案

发现这个堆栈溢出后<一href="http://stackoverflow.com/questions/13837697/viewpager-with-google-maps-api-v2-mysterious-black-view">ViewPager与谷歌地图API第2版:神秘的黑色查看并使用这个类来代替正常的地图片段

Found this stack overflow post ViewPager with Google Maps API v2: mysterious black view and used this class in place of the normal map fragment.

package com.myapp.gms.maps;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
import com.google.android.gms.maps.SupportMapFragment;

/**
 * @author btate
 */
public class TransparentSupportMapFragment extends SupportMapFragment {

    public TransparentSupportMapFragment() {}

    @Override
    public View onCreateView(LayoutInflater inflater, 
                                 ViewGroup view, 
                                 Bundle savedInstance) {

        View layout = super.onCreateView(inflater, view, savedInstance);
        FrameLayout frameLayout = new FrameLayout(getActivity());
        frameLayout.setBackgroundColor(
           getResources().getColor(android.R.color.transparent));
        ((ViewGroup) layout).addView(frameLayout,
            new ViewGroup.LayoutParams(
               LayoutParams.MATCH_PARENT, 
               LayoutParams.MATCH_PARENT
            )
        );
        return layout;
    }

}

这篇关于Android的图形页面通过滑动菜单掩盖菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆