小编Ama*_*jay的帖子

单击按钮时从Android应用程序发送电子邮件

我需要为用户提供功能,用户可以通过发送电子邮件来共享某些数据.我使用下面的代码.

    Intent email = new Intent(android.content.Intent.ACTION_SENDTO);
    email.setType("message/rfc822");
    email.putExtra(Intent.EXTRA_EMAIL, new String[] { to });
    email.putExtra(Intent.EXTRA_SUBJECT, subject);
    email.putExtra(Intent.EXTRA_TEXT, message);
    startActivity(Intent.createChooser(email,"Choose an Email client :"));
Run Code Online (Sandbox Code Playgroud)

这显示了Email,gmail,Skype和蓝牙发送供用户选择.我不希望用户显示Skype,在此列表中通过蓝牙发送.我需要做什么 ?我的手机中有WhatsApp,它做同样的事情,但没有在列表中显示电子邮件,蓝牙(设置 - >帮助 - >联系人 - > ...).只显示列表中的电子邮件和Gmail.我需要做同样的事情.

email android android-intent

22
推荐指数
1
解决办法
3万
查看次数

Android Matrial设计中的MultiLine EditText

<android.support.design.widget.TextInputLayout
            android:id="@+id/float_edit_description"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/ll4"
            android:layout_marginTop="5dp">

            <EditText
                android:id="@+id/edit_description"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:focusable="true"
                android:gravity="top|left"
                android:hint="Description"
                android:inputType="text"
                android:maxLines="3"
                android:paddingTop="0dp"
                android:scrollbars="vertical"
                android:textColor="@android:color/black"
                android:textColorHint="@color/hint_grey" />
        </android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

我想让上面的EditText有多行.如果用户按"enter",光标应该下到第二行.

android android-layout android-edittext androiddesignsupport

11
推荐指数
2
解决办法
8200
查看次数

Slider Menu片段中的可交换选项卡

我已经通过参考本教程实现了导航抽屉,现在我想要做的是在片段内显示滑动标签.即当我点击导航抽屉中的一个项目时,让我们说第一个项目,它应显示该项目的滑动标签.(我的列表视图中有6个片段.(同样: - A,B,C,D,E, F).我在A Fragment上需要3个可交换的标签.)

如果item1是Events,当我点击它时,它应该显示滑动标签.

但我面临以下问题: -

  1. 如何在片段内实现视图寻呼机?

  2. 片段可能扩展片段.

  3. 当一个片段正在扩展FragmentActivity时,那么在我的主要活动中,代码显示错误,说"类型不匹配",无法从A Fragment转换为片段.

这是我的Deep.java文件

    package com.amar.demo;

import info.androidhive.slidingmenu.adapter.NavDrawerListAdapter;
import info.androidhive.slidingmenu.model.NavDrawerItem;

import java.util.ArrayList;

import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

public class Deep extends Activity {
    private DrawerLayout mDrawerLayout;
    private ListView mDrawerList;
    private ActionBarDrawerToggle mDrawerToggle;

    // nav drawer title
    private CharSequence mDrawerTitle;

    // used to store app title
    private …
Run Code Online (Sandbox Code Playgroud)

android android-sliding android-fragments android-tabs android-navigation

8
推荐指数
1
解决办法
9679
查看次数

如何在每个项目的列表视图中实现简单的按钮

在此输入图像描述

我的列表视图项中有一些条目.在那里,我有一个简单的"喜欢按钮"(不像Facebook按钮).你可以看到上面提到的SCREENSHOT; 供参考.我点击按钮的那一刻; 当我再次登录时,我希望更改类似按钮的颜色,并且类似按钮的颜色应该保持不变(更改类似).

此外,所有条目必须使用json,使用cust_id,bus_id,Offer_id填充数据库; 我非常清楚.

当我再次点击相同的按钮(如按钮)时,其颜色已被更改.必须将其更改回默认颜色,并且必须从数据库中删除数据.

我怎样才能做到这一点...?1.如何获得点击按钮的价值.2.如何将更改的颜色恢复为默认值; 一旦按钮被重新点击.

Plz建议我......

这是按钮代码

holder.b1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (clicked) {
                    holder.b1.setBackgroundResource(R.drawable.like_icon_hover);
                } else {
                    holder.b1.setBackgroundResource(R.drawable.like_icon);
                }
                clicked = true;
            }
        });
Run Code Online (Sandbox Code Playgroud)

android listview android-intent android-button

7
推荐指数
1
解决办法
5714
查看次数

如何在spinner android中删除默认值?

我使用JSON从数据库中获取值并将它们插入到微调器中.此过程成功运行.但是当我点击旋转器时,我收到了两次Spinner提示; 如何从微调器中删除第一个默认值...

这是快照: - 希望你理解我的问题:在此输入图像描述

这是我的代码: -

private class GetCategories extends AsyncTask<Void, Void, Void> {
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    protected Void doInBackground(Void... arg0) {
        ServiceHandler jsonParser = new ServiceHandler();
        String json = jsonParser.makeServiceCall(URL_CATEGORIES,
                ServiceHandler.GET);
        if (json != null) {
            try {
                JSONObject jsonObj = new JSONObject(json);
                if (jsonObj != null) {
                    JSONArray categories = jsonObj
                            .getJSONArray("categories");
                    categoriesList.clear();
                    for (int i = 0; i < categories.length(); i++) {
                        JSONObject catObj = (JSONObject) categories.get(i);
                        Category cat = new Category( …
Run Code Online (Sandbox Code Playgroud)

android android-spinner

7
推荐指数
1
解决办法
3710
查看次数

背景图像从左向右移动

我正在开发应用程序.其中登录屏幕有bcakground图像.我想从左到右移动这个背景图片.我可以这样做吗?

我使用的示例代码,但这将移动图像并离开布局balnk.我不想要它.

    ImageView img_animation = (ImageView) findViewById(R.id.img_animation);

    TranslateAnimation animation = new TranslateAnimation(0.0f, 400.0f,
            0.0f, 0.0f);
    animation.setDuration(5000);
    animation.setRepeatCount(5);
    animation.setRepeatMode(2);
    animation.setFillAfter(true);
    img_animation.startAnimation(animation);
Run Code Online (Sandbox Code Playgroud)

我只想像这个应用程序屏幕一样实现:

检查设备中的此应用程序登录屏幕.登录屏幕在背景中有一个图像.这个图像从左向右移动.我怎样才能实现这个过程.请帮助我.

在此输入图像描述

android android-animation

5
推荐指数
1
解决办法
1250
查看次数

得到特定的id在顶部和其他之后

我从数据库表中获取50个ID.我想要一个特定的id在顶部说15,在那之后说所有其他的.我怎么能用SQL查询呢?

$sql = mysql_query("Select id from USERS");
Run Code Online (Sandbox Code Playgroud)

我搜索了很多但没有找到关于这个主题的任何内容.我不想使用两个查询.

php mysql sql

3
推荐指数
1
解决办法
67
查看次数

在ListView的列表项中为Button分配onClick事件

我创建了一个ListView从数据库填充的.每行都有一个按钮来更新列表和数据库中的项目值.我想为项目中使用的按钮添加onClick事件ListView.如何为列表项的按钮分配OnClickListener?

在此输入图像描述

addtooutlet.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:background="#ffffff">

<ListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

addtooutlet_list_item.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:padding="5dip" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="46dp"
    android:background="#ffffff"
    android:padding="5dip"
    android:weightSum="100" >

    <TextView
        android:id="@+id/item_bname"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="25"
        android:padding="2dp"
        android:text="Hello"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#000000"
        android:textSize="12dip" />

    <TextView
        android:id="@+id/item_bid"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="25"
        android:padding="2dp"
        android:text="Hello"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#000000"
        android:textSize="12dip" />

    <Button
        android:id="@+id/item_button"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@+id/item_bname"
        android:layout_marginRight="16dp"
        android:layout_weight="50"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:padding="2dp"
        android:text="Join"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#000000"
          android:textSize="12dip" />
   </LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

AddTooutlet.java

 public class AddToOutlet extends ListActivity …
Run Code Online (Sandbox Code Playgroud)

android listview android-listview

1
推荐指数
1
解决办法
1767
查看次数

如何使用php数组和Mysql在复选框中设置值

我想使用从数据库中获取的数组和值在checkbox中设置值.我有一个像1,2,3,6,8这样的字符串,它已经使用explode函数转换为字符串.我从数据库中获取了值,该数据库有10个元素,其中item_id为1,依此类推.现在我想逐个将这些值与该数组进行比较并匹配该值,复选框将被选中,如果不是,则复选框将保持未选中状态.总复选框为10. 5应根据其item_id和数组进行选择.

$string = 1,2,3,6,8;
$array = explode(',', $string);
Run Code Online (Sandbox Code Playgroud)

php mysql arrays checkbox jquery

0
推荐指数
1
解决办法
1577
查看次数