小编hun*_*erp的帖子

调用setCompoundDrawables()不会显示Compound Drawable

调用setCompoundDrawables方法后,未显示复合Drawable ..

Drawable myDrawable = getResources().getDrawable(R.drawable.btn);
btn.setCompoundDrawables(myDrawable, null, null, null);
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?

android android-layout android-drawable

305
推荐指数
7
解决办法
7万
查看次数

RelativeLayout正在全屏显示wrap_content

为什么FOOBARZ在没有元素的情况下一直在底部布局layout_height="fill_parent",所有元素都是高度的wrap_content? 在此输入图像描述

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TextView
        android:id="@+id/feed_u"
        android:layout_width="50dip"
        android:layout_height="50dip"
        android:layout_marginLeft="5dip"
        android:scaleType="centerCrop"
        android:drawableTop="@android:drawable/presence_online"
        android:text="U" />
    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/feed_u">
        <ImageView
            android:id="@+id/feed_h"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/btn_minus" />
        <ImageView
            android:id="@+id/feed_ha"
            android:layout_toLeftOf="@id/feed_h"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/btn_plus" />
        <TextView
            android:id="@+id/feed_t"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Title">
        </TextView>
        <TextView
            android:id="@+id/feed_a"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Band"
            android:layout_below="@id/feed_t">
        </TextView>
        <TextView
            android:id="@+id/feed_s"
            android:layout_below="@id/feed_a"
            android:text="S"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content">
        </TextView>
        <TextView
            android:id="@+id/feed_tm"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:text="FOOBARZ"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content">
        </TextView>

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

android android-layout

123
推荐指数
3
解决办法
5万
查看次数

MediaPlayer.prepareAsync的IllegalStateException

05-19 11:52:51.622: ERROR/MediaPlayer(1291): prepareAsync called in state 8
05-19 11:52:51.622: WARN/System.err(1291): java.lang.IllegalStateException
Run Code Online (Sandbox Code Playgroud)
try {
    mp = MediaPlayer.create(
            Main.this,
            Uri.parse("http://codejanitor.us/good.mp3"));
    mp.setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.start();
        }
    });
    try {
        mp.prepareAsync();
    } catch (IllegalStateException e) {
        e.printStackTrace();
    }
} finally {
    if (mp != null) {
        mp.release();
        mp = null;
    }
}
Run Code Online (Sandbox Code Playgroud)

交替

如果我做:

try {
    mp = MediaPlayer.create(
            AmazonClipActivity.this,
            Uri.parse("http://codejanitor.us/good.mp3"));
    mp.setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.start();
        }
    });
} finally {
    if …
Run Code Online (Sandbox Code Playgroud)

android android-mediaplayer

34
推荐指数
3
解决办法
4万
查看次数

如何避免在Android Facebook SDK中已经授权

当我使用Facebook的Android SDK单点登录时,我得到一个完全无用的页面.

"你已经授权了happyapp.按"好的"继续.

此页面会破坏用户体验.我怎么能摆脱它.很多人都看到了这个,但没有发布任何解决方案.

甚至Facebook承认这是一个问题,请参阅:http://forum.developers.facebook.net/viewtopic.php?id = 84548

有谁知道任何解决方法吗?

android facebook

31
推荐指数
2
解决办法
2万
查看次数

如何在Apple的开发者门户网站中保留iPhone应用程序名称?

我想保留一个我打算在接下来的90天内构建的应用程序名称,我该如何在苹果的Web开发人员门户网站上做到这一点?

iphone

24
推荐指数
3
解决办法
4万
查看次数

无法实例化Fragment

无法实例化片段确保类名存在,是公共的,并且具有公共的空构造函数

是因为我的片段不是静态类吗?是因为我的片段是一个内在阶级?

如果我将Fragment设为静态类,那么我对findViewById的所有引用都会失败,这意味着很多重构.

如何在不将内部Fragment变成静态类的情况下解决这个问题?

android android-fragments

24
推荐指数
3
解决办法
4万
查看次数

什么是最强大的Android的HTTP库?

我正在寻找一个处理HTTP POST,多部分等的库.是否有一个事实上的标准库来使这些请求在Android上更容易?

android http

19
推荐指数
4
解决办法
3万
查看次数

如何在onCreate之后立即启动动画?

我正在关注http://developer.android.com/guide/topics/graphics/view-animation.html#frame-animation并进行细微更改.我决定制作动画循环并希望它从一开始就开始.

我的动画是drawable/listening.xml:

<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item
    android:drawable="@drawable/l_01"
    android:duration="200" />
<item
    android:drawable="@drawable/l_02"
    android:duration="200" />
<item
    android:drawable="@drawable/l_03"
    android:duration="200" />
</animation-list>
Run Code Online (Sandbox Code Playgroud)

和我的初始代码:

 @Override public void onWindowFocusChanged(boolean hasFocus)  { 
      super.onWindowFocusChanged(hasFocus); 
      animImg = (ImageView)findViewById(R.id.listen_anim);
      animImg.setBackgroundResource(R.drawable.listening);
      anim = (AnimationDrawable) animImg.getBackground(); 
      anim.start();
 };
Run Code Online (Sandbox Code Playgroud)

我看到的只是第一帧而没有其他图像.

android android-animation

15
推荐指数
4
解决办法
3万
查看次数

如何访问android中的所有drawable?

只有一些drawable可以通过 <ImageButton src="@+android:drawable/ 语法访问 .例如,expandder_ic_maximized不可访问,但它清楚地显示在 http://androiddrawableexplorer.appspot.com/

它是如此令人沮丧,必须下载drawables并手动将它们放在我的drawables文件夹....任何想法如何解决这个???

android

14
推荐指数
2
解决办法
4万
查看次数

在应用结算中:未找到商品

我已按照应用结算中的步骤操作:

  1. 已安装的演示应用
  2. 发布了应用内商品
  3. 没有发布应用程序本身

虽然我CAN购买物品,有一个奇怪的警告"项目未找到"我不得不解雇之前,我可以去购买屏幕.

和此日志错误:

E/Volley(1384): [157] BasicNetwork.performRequest: Unexpected response code 500 for https://android.clients.google.com/fdfe/details?doc=subs:com.testorooney.testo:sword_001
Run Code Online (Sandbox Code Playgroud)

android in-app-billing

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