3

我有这个代码,我正在处理 twitter rss 提要
我也有 main.xml 列表视图但我想知道如何隐藏浏览器地址栏。当我单击 twitter 提要时隐藏浏览器地址栏

xmlparsemain.java

public class xmlparsemain extends DashBoardActivity {
/** Called when the activity is first created. */
WebView ourBrow;
ListView lv1;
ProgressDialog ShowProgress;
public ArrayList<Post> PostList = new ArrayList<Post>();
public SitesList siteslist =new SitesList();

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // making it full screen
    requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.twitter);

    setHeader(getString(R.string.Twitter), true, true, true);

    System.out.println(siteslist.getTwitterValue());

    lv1 = (ListView) findViewById(R.id.listView1);

    ShowProgress = ProgressDialog.show(xmlparsemain.this, "","Loading. Please wait...", true);
            new loadingTask().execute("http://api.twitter.com/1/statuses/user_timeline.rss?screen_name="+siteslist.getTwitterValue().toString()+"");


    lv1.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view,int position, long id) {

            Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(PostList.get(position).getUrl()));
            startActivity(intent);
//              ourBrow.getSettings().setJavaScriptEnabled(true);
//              ourBrow.getSettings().setLoadWithOverviewMode(true);
//              ourBrow.getSettings().setUseWideViewPort(true);
//              ourBrow.setWebViewClient(new Intent(Intent.ACTION_VIEW).setData(Uri.parse(PostList.get(position).getUrl())));
//              ourBrow.setWebViewClient(new ourViewClient());
//              InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
//              imm.hideSoftInputFromWindow(ourBrow.getWindowToken(), 0);

        }
    });

}
class loadingTask extends AsyncTask<String, Void, String> {

    protected String doInBackground(String... urls) {

        SAXHelper sh = null;
        try {
            sh = new SAXHelper(urls[0]);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        sh.parseContent("");
        return "";
    }

    protected void onPostExecute(String s) {
        lv1.setAdapter(new EfficientAdapter(xmlparsemain.this, PostList));
        ShowProgress.dismiss();
    }
}
class SAXHelper {
    public HashMap<String, String> userList = new HashMap<String, String>();
    private URL url2;

    public SAXHelper(String url1) throws MalformedURLException {
        this.url2 = new URL(url1);
    }
    public RSSHandler parseContent(String parseContent) {
        RSSHandler df = new RSSHandler();
        try {
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();
            XMLReader xr = sp.getXMLReader();
            xr.setContentHandler(df);
            xr.parse(new InputSource(url2.openStream()));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return df;
    }
}
class RSSHandler extends DefaultHandler {
    private Post currentPost = new Post();
    StringBuffer chars = new StringBuffer();
    @Override
    public void startElement(String uri, String localName, String qName,Attributes atts) {
        chars = new StringBuffer();
        if (localName.equalsIgnoreCase("item")) {
        }
    }

    @Override
    public void endElement(String uri, String localName, String qName)
            throws SAXException {

        if (localName.equalsIgnoreCase("title") && currentPost.getTitle() == null) {
        currentPost.setTitle(chars.toString());
        }

        if (localName.equalsIgnoreCase("pubDate")&& currentPost.getDate() == null) {
            currentPost.setDate(chars.toString());
        }
        if (localName.equalsIgnoreCase("link")&& currentPost.getUrl() == null) {
            currentPost.setUrl(chars.toString());
        }

        if (localName.equalsIgnoreCase("item")) {
            PostList.add(currentPost);
            currentPost = new Post();
        }
    }

    @Override
    public void characters(char ch[], int start, int length) {
        chars.append(new String(ch, start, length));
    }
}
}

post.java

public class Post {

private String title;
private String thumbnail;
private String url;
private String description;
private String date;

public String getTitle() {
    return title;
}

public void setTitle(String title) {
    this.title = title;
}

public String getThumbnail() {
    return thumbnail;
}

public void setThumbnail(String thumbnail) {
    this.thumbnail = thumbnail;
}

public String getUrl() {
    return url;
}

public void setUrl(String url) {
    this.url = url;
}

public void setDescription(String description) {
    this.description = description;
}

public String getDescription() {
    return description;
}

public void setDate(String date)  {
      this.date=date;      
    }

public String getDate() {
    return date;
}

}

高效适配器.java

 public class EfficientAdapter extends BaseAdapter {
private Activity activity;
private ArrayList<Post> data;
private static LayoutInflater inflater = null;
//public ImageLoader imageLoader;
ViewHolder holder;

EfficientAdapter(Activity a, ArrayList<Post> d) {

    activity = a;
    data = d;
    inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

@Override
public int getCount() {
    return data.toArray().length;
}

@Override
public Object getItem(int position) {
    return position;
}

@Override
public long getItemId(int position) {
    return position;
}

public static class ViewHolder {
    public TextView label;

    public TextView addr;
            public ImageView image;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View vi = convertView;

    if (convertView == null) {
        vi = inflater.inflate(R.layout.row, null);
        holder = new ViewHolder();
        holder.label = (TextView) vi.findViewById(R.id.title);
        holder.addr = (TextView) vi.findViewById(R.id.details);
        holder.image = (ImageView) vi.findViewById(R.id.thumb);
        vi.setTag(holder);

    } else

    holder = (ViewHolder) vi.getTag();
    Resources res = activity.getResources();
    holder.label.setText(data.get(position).getTitle());
    holder.addr.setText(data.get(position).getDate());
    Bitmap micon1=BitmapFactory.decodeResource(res, R.drawable.tweet); 
    holder.image.setImageBitmap(Bitmap.createScaledBitmap(micon1, 72, 72, false));
    return vi;
}

 }

如何隐藏浏览器地址栏

4

1 回答 1

0

据我所知,你不能,除了弹出窗口。由于它适用于 Android(因为您为 Android 标记了您的问题),所以浏览器栏应该在客户端滚动时自动隐藏(以及滚动条,直到它感应到触摸交互)。这是删除浏览器栏(以及滚动条,如果需要)的弹出窗口代码:

var popup = window.open("http://urlinquestion.com", "newPOPUP", 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=300')
于 2012-08-20T06:57:06.157 回答