【问题标题】:how to create links on spinner? - android [duplicate]如何在微调器上创建链接? - 安卓[重复]
【发布时间】:2013-10-22 14:23:31
【问题描述】:

是否可以发送微调器的链接? 我四处搜索,大多数情况下它们是数据输入,而不是如果您选择了某个微调器数组,那么它会将您链接到某个地方。 有可能吗?

另外,在我的图形布局中,它总是说项目 1,然后是下面的子项目 1。有办法改吗?

因为 android:text="" 在 textView 上工作,我认为它可以在这里工作,但我猜我错了

附:我正在尝试制作微调器,以便将其选中并链接到 webView 小部件。 仍在思考如何做到这一点,但我想我什至无法制作一个微调器来链接。

【问题讨论】:

  • 哦,我刚发帖后就看到了,但实际上我该如何删除这篇文章?我正在阅读它,看看我是否可以先对此有所了解

标签: android hyperlink spinner


【解决方案1】:

您可以使用以下方法链接微调器的文本

http://developer.android.com/reference/android/text/util/Linkify.html

    TextView text=(TextView)findViewById(R.id.text1);   
    text.setText("Its not just hello world but 
                  the world is full of links....small links ,
                  big links...as... www.google.com ");
    Linkify.addLinks(text, Linkify.ALL);

现在,文本中的文本 www.google.com 将被链接。

或者你可以使用

    spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

  @Override
  public void onItemSelected(AdapterView<?> arg0, View arg1,
      int arg2, long arg3) {
  startActivity(new Intent(Intent.ACTION_VIEW,
         Uri.parse("http://www.google.com")));
 }

  @Override
  public void onNothingSelected(AdapterView<?> arg0) {}

 });

在微调器的 onItemselected 内 项目选择

【讨论】:

  • 非常感谢。我会尝试一下,仍然试图在我的脑海中得到想法对不起,我想我之前问过这些问题,但感谢您的回复^_^
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-12-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-08
  • 1970-01-01
  • 2020-02-29
相关资源
最近更新 更多