小编Bas*_*rif的帖子

滚动时Android-Listview项目背景颜色发生变化

我的ListView两个Textviews.在一行中,第一行是名称,第二行是结果.我需要TextView根据结果更改结果的背景颜色.就像传递然后结果TextView颜色将是绿色,当失败结果TextView颜色将是红色.我有十行ListView.我试过这样的

    @Override
public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub

    ViewHolder holder;
    if(convertView==null)
    {
        holder = new ViewHolder();
        convertView = inflater.inflate(R.layout.items, null);

        holder.imgViewLogo = (ImageView) convertView.findViewById(R.id.imgViewLogo);
        holder.txtViewTitle = (TextView) convertView.findViewById(R.id.txtViewTitle);
        holder.txtViewDescription = (TextView) convertView.findViewById(R.id.txtViewDescription);
        holder.txtholder = (TextView) convertView.findViewById(R.id.holder1);
        holder.img = (ImageView)  convertView.findViewById(R.id.temperrr);
        convertView.setTag(holder);
    }
    else
        holder=(ViewHolder)convertView.getTag();

    ItemBean bean = (ItemBean) itemList.get(position);

    holder.imgViewLogo.setImageResource(bean.getImage());
    holder.txtViewTitle.setText(bean.getTitle());
    holder.txtViewDescription.setText(bean.getDescription());
  //------------------  
    if (position==0)
    {
        if(GridviewAdapter.glu>=81)
        {
        holder.img.setImageResource(R.drawable.red_arrow);
        holder.txtViewDescription.setBackgroundResource(R.color.resultred); …
Run Code Online (Sandbox Code Playgroud)

android android-listview

3
推荐指数
2
解决办法
8599
查看次数

Android Webview中的字体大小调整功能

我一直在开发一个Android RSS新闻阅读器.我想在Webview中加载新闻时添加两个按钮来调整字体大小.任何人都可以告诉我,如何创建一个更改Webview字体大小的功能?

android

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

在android中检索当前的外出电话号码时没有得到正确的值

我使用以下广播接收器来检索拨出的电话号码.

@Override
public void onReceive(Context context, Intent intent) {
    mContext = context;
    mIntent = intent;
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    int events = PhoneStateListener.LISTEN_CALL_STATE;
    tm.listen(phoneStateListener, events);
}

private final PhoneStateListener phoneStateListener = new PhoneStateListener() {
    @Override
    public void onCallStateChanged(int state, String incomingNumber) {



        switch (state) {
        case TelephonyManager.CALL_STATE_IDLE:

            break;

        case TelephonyManager.CALL_STATE_OFFHOOK:


                dialingNumber = mIntent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
                Toast.makeText(mContext, "Local Call Number- " + dialingNumber,Toast.LENGTH_SHORT).show();


                break;
            }
                return;
        }



        Log.i(">>>Broadcast", "onCallStateChanged " + callState);
        super.onCallStateChanged(state, incomingNumber);
    }
};
Run Code Online (Sandbox Code Playgroud)

有时它返回null或我之前调用的数字.是否有另一种方法来检索当前呼叫的呼入/呼出电话号码?

android phone-state-listener

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

如何在Jake Wharton的TitlePageIndicator中设置字体?

在我的应用中我使用Jake Wharton的TitlePageIndicator.我想知道我们是否可以将字体设置为TitlepagerIndicator.

这是xml,

<com.viewpagerindicator.TitlePageIndicator
     android:id="@+id/indicatortitle"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_marginBottom="10dp"
     android:padding="10dip"
     app:selectedColor="#000"
     android:textColor="#a0a0a0"
     android:textSize="25dp" />
Run Code Online (Sandbox Code Playgroud)

在主要活动中,

    TitlePageIndicator indicator = (TitlePageIndicator)findViewById(R.id.indicatortitle);
indicator.setViewPager(mViewPager);
    indicator.setFooterIndicatorStyle(IndicatorStyle.Triangle);
Run Code Online (Sandbox Code Playgroud)

android typeface android-viewpager actionbarsherlock

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

无法使用GCM发送推送消息

我在我的Android应用程序中实现了GCM.我有1461位用户注册.我正在使用JSON方法向服务器发送消息.当我尝试发送推送消息时,我得到一个错误

"批量邮件数量(1461)超过允许的最大数量(1000)"

是因为GCM对邮件数量有限制吗?或者它是JSON的问题?

android json google-api google-cloud-messaging

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

使用PHP生成序列号

我想CHN000001,CHN000002,CHN000003使用PHP 生成一系列序列号等.如果有100个数字,那么最后一个应该是这样的CHN000100.如果它是1000,那么序列应该看起来像CHN001000.谁能告诉我如何为这个过程实现"for"循环?

php

0
推荐指数
2
解决办法
4805
查看次数

在浏览Viewpager时,Android应用程序卡住了

在我的Android应用程序中,我有3个片段.AB和CI正在进行一些XML解析和填充listviews.从A到B和B到C的擦除非常流畅.但是当我尝试从C刷到B和B到A时,它卡住了大约10秒钟.A,> B-> C很顺利.而C-> B-> A有问题.真的很烦人.谁能帮我摆脱这个问题?...谢谢预先....

这是我的MainActivity =>

    public class MainActivity extends FragmentActivity {
    private ViewPager mViewPager;
    private ProgressDialog pd;
    Button settings;
    static TextView flashnews;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        SharedPreferences mlmprf = getSharedPreferences("malayalam", MODE_PRIVATE);
        final SharedPreferences.Editor mlmedit = mlmprf.edit();

        if(mlmprf.getBoolean("enable", true))
     {
         A.headflag="malayalam";
     }
     else
     {
         A.headflag="english";
     }

           flashnews=(TextView)findViewById(R.id.flashs);
       flashnews.setSelected(true);
       flashnews.setEllipsize(TruncateAt.MARQUEE);
       flashnews.setHorizontallyScrolling(true);
       flashnews.setSingleLine(true);
       flashnews.setLines(1);

      PagerTabStrip pagerTabStrip = (PagerTabStrip) findViewById(R.id.pager_title_strip);
        pagerTabStrip.setDrawFullUnderline(true);
        pagerTabStrip.setTabIndicatorColor(Color.rgb(174, 1, 34));
        mViewPager = (ViewPager) findViewById(R.id.viewpager);
            mViewPager.setAdapter(new MyAdapter(this));
      }

 private class MyAdapter extends FragmentPagerAdapter{

        private Context …
Run Code Online (Sandbox Code Playgroud)

android android-viewpager

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

使用共享操作提供程序时检测共享者应用程序

有什么方法可以检测到在使用共享操作提供程序时选择了哪个共享应用程序,以便我可以为不同的应用程序发送不同的消息?我正在使用以下方法进行共享操作提供程序,

mShareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_item_share).getActionProvider();

        mShareActionProvider.setShareIntent(getDefaultShareIntent());
Run Code Online (Sandbox Code Playgroud)

和意图,

 public Intent getDefaultShareIntent(){
              String message = Fname + Mobileno + Homeno + Workmail + Homemail
                + Gtalk + Skype + Address + Company + Title + Website;
      Intent shareIntent = new Intent(Intent.ACTION_SEND);
              shareIntent.putExtra(Intent.EXTRA_TEXT, message); 


         return shareIntent; 


    }
Run Code Online (Sandbox Code Playgroud)

android shareactionprovider

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