我想通过使用XML样式制作这种按钮[相同的背景和文本]颜色

这只是一个例子,我想写一些其他文本,如:关于我
我还在使用Photoshop设计师创建的按钮
<ImageButton
android:id="@+id/imageButton5"
android:contentDescription="AboutUs"
android:layout_width="wrap_content"
android:layout_marginTop="8dp"
android:layout_height="wrap_content"
android:layout_below="@+id/view_pager"
android:layout_centerHorizontal="true"
android:background="@drawable/aboutus" />
Run Code Online (Sandbox Code Playgroud)
注意:我需要各种尺寸和形状的按钮
我不想在我的Android应用程序中使用任何图像,我只想使用XML
我必须在Android模拟器中添加一个Exchange帐户才能使用GCM和Calendar API.我正在按照本教程创建帐户,但每当我尝试设置帐户时,都会收到以下错误:
Couldn't open Connection to Server
Run Code Online (Sandbox Code Playgroud)
通过使用任何其他API,我得到:the server requires security features your phone does not support对于一个例子中的Android 4.0的API
以下是我注意到的一些事情:
PORT - 443默认情况下还有一个字段可供获取.AVD屏幕截图:

帐户设置无法完成屏幕截图:

如果我这样做:

我收到此错误消息:

我使用相同的凭据,我总是用来登录我的GMAIL帐户,但在模拟器中创建Exchange帐户的过程中我得到了 Incorrect UserName or Password
请看下面的截图:

在上面的图像我使用了我的谷歌帐户用户名
(i.e: androidsmartappdeveloper@googlemail.com)
Run Code Online (Sandbox Code Playgroud)
并输入了正确的密码,但收到以下错误:

我尝试过使用6个不同的电子邮件ID,并有朋友尝试,但我们都得到相同的对话框 Couldn't Finish
我该如何解决这个问题?
早些时候我使用AVD并使用AVD我能够使用GCM,日历等.我删除了AVD,现在每当我尝试使用较低版本创建AVD时,我得到了the server requires security features your phone does not support
我编写了一个代码,我在GridView中显示图像,但现在我想在每个图像的底部显示文本.
我想像这样展示我的网格:

但是这样[也想显示Text for Image]:

main.xml中:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:verticalSpacing="0dp"
android:horizontalSpacing="0dp"
android:stretchMode="columnWidth"
android:numColumns="2"
/>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud) 我试图显示项目列表以及GrandTotal Amount,但每当我在我的代码中使用此代码获取NullPointerException时,请参阅下面的代码:
if (Constants.sItem_Detail.size() > 0) {
Double mGTotal = Double.parseDouble(Constants.sItem_Detail.get(0).get(com.example.sample.CartAdapter.KEY_TOTAL));
for (int i = 1; i < Constants.sItem_Detail.size(); i++) {
mGTotal = mGTotal + Double.parseDouble(Constants.sItem_Detail.get(i).get(com.example.sample.CartAdapter.KEY_TOTAL));
}
mGrandTotal = String.valueOf(new DecimalFormat("##.#").format(mGTotal));
mTxtViewGrandTotal.setText(mGrandTotal);
myTextVeiwGrandTotal.setText(mGrandTotal);
Run Code Online (Sandbox Code Playgroud)
特别是,虽然我使用这些行得到错误:
Double mGTotal = Double.parseDouble(Constants.sItem_Detail.get(0).get(com.example.sample.CartAdapter.KEY_TOTAL));
mGTotal = mGTotal + Double.parseDouble(Constants.sItem_Detail.get(i).get(com.example.sample.CartAdapter.KEY_TOTAL));
Run Code Online (Sandbox Code Playgroud)
我试过以下代码:
if (Constants.sItem_Detail.size() > 0) {
Toast.makeText(getApplicationContext(), "Constants is Greater Than 0", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "Constants is Less Than < 0", Toast.LENGTH_LONG).show();
}
Run Code Online (Sandbox Code Playgroud)
并且获取常量大于0,显示购物车中的商品数量为1,但每当我在代码中使用此行时出现问题,是否是从适配器获取价值的正确方法?
Double.parseDouble(Constants.sItem_Detail.get(0).get(com.example.sample.CartAdap????ter.KEY_TOTAL));
Run Code Online (Sandbox Code Playgroud)
实际上我正在计算Adapter类中每个项目的总金额,现在试图在Activity中显示所有总金额的总和为总计,但面对问题,告诉我我在哪里做错了?
这是完整的代码:
CartActivity.java:
protected void onCreate(Bundle savedInstanceState) { …Run Code Online (Sandbox Code Playgroud) 我正在编写一个应用程序,我正在尝试发送包含一些数据的电子邮件,但每当我点击"提交"按钮发送电子邮件时,获取:不幸的是应用程序已停止
错误:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND typ=text/plain (has extras) }
Run Code Online (Sandbox Code Playgroud)
码:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
String aEmailList[] = { "myaccount@gmail.com" };
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body.toString()));
startActivity(emailIntent);
Run Code Online (Sandbox Code Playgroud)
logcat的:
08-01 08:34:22.518: E/AndroidRuntime(1043): FATAL EXCEPTION: main
08-01 08:34:22.518: E/AndroidRuntime(1043): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SENDTO typ=text/plain (has extras) }
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.app.Activity.startActivityForResult(Activity.java:3370)
08-01 08:34:22.518: E/AndroidRuntime(1043): at …Run Code Online (Sandbox Code Playgroud)