java无法通过imagebutton 安卓 studio打开网页
下面是我的java文件,其中一个片段用于创建多个打开多个WeebPage的图像按钮。 请帮忙。 把我当傻瓜
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootview = inflater.inflate(R.layout.menu8_layout, container, false);
return rootview;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Button bt1 = (Button) findViewById(R.id.btn_click_login);
btn_login.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
}
Intent myWebLink = new Intent(安卓.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("http://google.com"));
startActivity(myWebLink);
});
}
}
下面是相关的xml文件
<LinearLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
安卓:orientation="vertical" 安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:background="#000000">
<Button
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:id="@+id/bt1"
安卓:clickable="true"
安卓:autoLink="web"
安卓:cursorVisible="true"
安卓:linksClickable="true"
安卓:onClick="goToSo"
安卓:text="some" />
共 (0) 个答案