【问题标题】:How to hide the RSS list view browser in Android如何在 Android 中隐藏 RSS 列表视图浏览器
【发布时间】:2013-03-01 22:25:00
【问题描述】:

我正在研究 RSS XML saxparser。我正在创建 RSS 列表视图,以便单击任何项​​目将打开 URL。但我想隐藏 RSS 选择列表视图浏览器。

我也有 RSS 列表视图并创建新的活动文件。

See this same type of question 我可以在这里做什么?

lv1.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
            String temp=PostList.get(position).getUrl();
            String temp1=PostList.get(position).getGuid();
            if(temp.contains("http://"))
            {
            Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(PostList.get(position).getUrl()));
                //Intent intent = new Intent(RSSAndroidActivity.this,com.sygnet.rss.Listview.class);
                startActivity(intent);
            }else if(temp1.contains("http://"))
            {
            Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(PostList.get(position).getGuid()));
                //Intent intent = new Intent(RSSAndroidActivity.this,com.sygnet.rss.Listview.class);
                startActivity(intent);
            }else
            {
                Toast.makeText(getApplicationContext(), "please, it cant able to open the link for this Feed", Toast.LENGTH_LONG).show();
            }
        }
    });

Listview.java

public class Listview extends Activity{
WebView ourBrow;
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listview);

    ourBrow = (WebView)findViewById(R.id.wvBrowser);

    ourBrow.getSettings().setJavaScriptEnabled(true);
    ourBrow.getSettings().setLoadWithOverviewMode(true);
    ourBrow.getSettings().setUseWideViewPort(true);
    ourBrow.setWebViewClient(new ourViewClient());

//        ourBrow.loadUrl(siteslist.getWebsiteValue());

   //hiding the keyboard after using an EditText
    InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(ourBrow.getWindowToken(), 0);

}
}

【问题讨论】:

  • 如果你不需要使用网络浏览器,你为什么要使用它?
  • @kaluwila 我想点击任何项目打开另一个隐藏网络浏览器的窗口
  • 您对网络浏览器有什么要求?如果您需要显示对话框,您只需在 onitemclick 方法中添加警报对话框,而不是添加新的意图来加载 Web 浏览器。
  • ok kumar,请告诉我你真正想在你的 onitemclick 方法中做什么?
  • @kaluwila 我正在处理 RSS 提要列表视图单击该提要打开另一个活动窗口隐藏网页的地址栏

标签: android listview browser rss hide


【解决方案1】:
public class WebViewActivity extends DashBoardActivity {
/** Called when the activity is first created. */
WebView ourBrow;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.webview);


    ourBrow = (WebView)findViewById(R.id.wvBrowser);

    ourBrow.getSettings().setJavaScriptEnabled(true);
    ourBrow.getSettings().setLoadWithOverviewMode(true);
    ourBrow.getSettings().setUseWideViewPort(true);
    ourBrow.setWebViewClient(new ourViewClient());

    ourBrow.loadUrl(www.indianbloggerpost.com);

   //hiding the keyboard after using an EditText
    InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(ourBrow.getWindowToken(), 0);



}

【讨论】:

    【解决方案2】:

    如果您与网络浏览器没有任何关系,只需将其删除并调用新活动作为休闲活动。在此活动中,您必须使用网络视图(隐藏地址栏)

    代码:

    lv1.setOnItemClickListener(new OnItemClickListener() {
       public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
           //call to new intent here
            Intent i = new Intent(yourContext,yourActivity.class);
            i.putExtra("URL", your url);// set your url
            yourContext.startActivity(i);       
    
           }
    });
    

    你的Activity.class

    public class yourActivity extends Activity{
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.layout_web_view);
            Intent intent = getIntent();
            String url= intent.getStringExtra("URL");
            WebView mWebView= (WebView )findViewById(R.id.web_view);                
            mWebView.loadUrl(url);   
        }   
    }
    

    layout_web_view.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" 
        android:id="@+id/contact_wev_view"
        >
    <WebView 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" 
        android:id="@+id/web_view"/>
        </LinearLayout>
    

    【讨论】:

    • 这个我知道,但我正在做我的另一项活动
    • 隐藏网页地址栏
    • ok kumar,你需要一个网络视图,所以我编辑了答案,希望它能解决你的问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-16
    • 1970-01-01
    • 2017-10-24
    • 2016-08-16
    • 1970-01-01
    相关资源
    最近更新 更多