无法在android中创建框
我的客户要求创建一个有三个按钮的页面,点击这些按钮,它必须到达我网站上指定的URL,如果我们选择登录,它必须在我的web应用程序中获得特定的页面。我对android非常陌生,也不知道我是如何创建的,但他希望所有这些都放在一个框中。我已经搜索过了很多网站说自定义对话框,等等。。。但我没有找到任何解决办法。他给了我一些网站作为参考,网站的布局必须是这样的。。该url是 在这个url中,他希望布局像第一个屏幕截图无法在android中创建框,android,Android,我的客户要求创建一个有三个按钮的页面,点击这些按钮,它必须到达我网站上指定的URL,如果我们选择登录,它必须在我的web应用程序中获得特定的页面。我对android非常陌生,也不知道我是如何创建的,但他希望所有这些都放在一个框中。我已经搜索过了很多网站说自定义对话框,等等。。。但我没有找到任何解决办法。他给了我一些网站作为参考,网站的布局必须是这样的。。该url是 在这个url中,他希望布局像第一个屏幕截图 import android.app.Activity; import android.
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
private Button login;
private Button register;
private Button ContactUs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
login = (Button)findViewById(R.id.button1);
register = (Button)findViewById(R.id.button2);
ContactUs= (Button)findViewById(R.id.button3);
login.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Uri uri = Uri.parse("some url");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
public void onClick1(View arg0) {
// TODO Auto-generated method stub
}
});
register.setOnClickListener(new OnClickListener() {
public void onClick2(View v) {
// TODO Auto-generated method stub
Uri uri = Uri.parse("some url");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
});
ContactUs.setOnClickListener(new OnClickListener() {
public void onClick1(View v) {
// TODO Auto-generated method stub
Uri uri = Uri.parse("some url");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
});
}
布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#ffffff"
android:weightSum="6">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3.5" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="60dp"
android:src="@drawable/tasknbilllogo" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="260dp"
android:background="#ffff66"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:orientation="vertical"
android:weightSum="3" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffa64c"
android:text="-----"
android:layout_marginLeft="60dp"
android:layout_marginRight="60dp"
android:textColor="#4c4cff" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="60dp"
android:layout_marginRight="60dp"
android:background="#ffa64c"
android:textColor="#4c4cff"
android:text="Register" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="60dp"
android:layout_marginRight="60dp"
android:background="#ffa64c"
android:textColor="#4c4cff"
android:text="------" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
使用列表视图:
.XML
在onCreate方法中:
阵列:
// Defined Array values to show in ListView
String[] values = new String[] { "Login",
"Register",
"Contact Us"};
新适配器:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, values);
而听众:
以下是关于对话框的所有需要了解的内容:我已经看过了,但在我看到的大多数自定义布局链接中,它们都会说单击一些“完成”或一些“提交”按钮,然后打开列表视图。但对我来说,它必须在对话框中创建一个listview,对话框必须在页面的下半部分,因为页面的上半部分充满了徽标。我从10天开始尝试,但没有乐趣,我只剩下3天的时间来完成…所以我有点急于阅读我发布的链接。小心你不需要任何更多的信息。我试了10天,你应该在第一天就找到那个链接。然后把它打印出来,研究一下,让它成为你的。最后你终于挺过来了。最晚9天前。
listView = (ListView) findViewById(R.id.list);
// Defined Array values to show in ListView
String[] values = new String[] { "Login",
"Register",
"Contact Us"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, values);
// Assign adapter to ListView
listView.setAdapter(adapter);
// ListView Item Click Listener
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
switch(position){
case 1:
Uri uri = Uri.parse("https://app.tasknbill.net/login.aspx");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
break;
case 2:
uri = Uri.parse("https://app.tasknbill.net/register.aspx");
intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
break;
case 3:
uri = Uri.parse("https://tasknbill.net/#contact");
intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
break;
}
}
});