小编San*_*ela的帖子

如何在Android Edittext上以编程方式设置drawableRight?

我知道用XML设置drawableRight.但我需要以编程方式进行,因为它是根据某些条件进行的更改.

android drawable

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

如何在Android中创建可调整大小的ImageView

我希望我的应用程序的用户能够在运行时修改图像.用户应该能够通过点击图像视图的角落并拖动它来修改图像的高度和宽度,如下图所示:

在此输入图像描述

我花了很多时间研究这个,我发现 了多点触控的感觉,并将一个大的位图文件调整为缩放输出文件,如Pinch Zoom,但这些都不符合我的要求.

目前我正在调整位图使用下面的结果和改变宽度的onprogress改变方法的搜索栏而不是帧.通过使用此功能,更改图像大小不能正常工作.

public static Bitmap decodeFile(File f,int WIDTH,int HIGHT){

    try {
        //Decode image size
        BitmapFactory.Options o = new BitmapFactory.Options();
        o.inJustDecodeBounds = true;
        BitmapFactory.decodeStream(new FileInputStream(f),null,o);

        //The new size we want to scale to
        final int REQUIRED_WIDTH=WIDTH;
        final int REQUIRED_HIGHT=HIGHT;

        //Find the correct scale value. It should be the power of 2.
        int scale=1;
        while(o.outWidth/scale/2>=REQUIRED_WIDTH && o.outHeight/scale/2>=REQUIRED_HIGHT)
            scale*=2;

        //Decode with inSampleSize
        BitmapFactory.Options o2 = new BitmapFactory.Options();
        o2.inSampleSize=scale;
        return BitmapFactory.decodeStream(new FileInputStream(f), null, o2);
    }
        catch (FileNotFoundException e) …
Run Code Online (Sandbox Code Playgroud)

android bitmap image-resizing

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

解析android-L的数据失败

我已经为L Developer预览更新了我的sdk.我无法加载我layoutAPI 20

我的JDK compilence和.class文件兼容性是1.7.

这是快照

1)

在此输入图像描述

2)

在此输入图像描述

所以我可以改变任何编译级别吗?

java android android-5.0-lollipop

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

RotateDrawable以编程方式在android中

我怎么能放弃fromFegrees,toDegreesandroid:color="#000000"编程?

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item >


        <rotate 
            android:fromDegrees="45"
            android:toDegrees="45"
            android:pivotX="-40%"
            android:pivotY="87%" >

            <shape 
            android:shape="rectangle"  >
            <stroke android:color="@android:color/transparent" android:width="10dp"/>
            <solid  
                android:color="#000000"  />
        </shape>

        </rotate>
    </item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)

我在视图的背景中使用此xml.

我必须以编程方式创建三角形.所以需要以编程方式创建RotationDrawable.

android shapedrawable animationdrawable

7
推荐指数
2
解决办法
4984
查看次数

如何在Scrollview中制作多列表视图?

在我的代码中有四个listview我如何使屏幕可滚动显示所有listview的所有数据?不是这个代码使listview可滚动我不希望listview滚动想要ScreenScrollable像这个图像

   <?xml version="1.0" encoding="UTF-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="#ffffff"
   android:orientation="vertical" >

    <RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/imagelogo2"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/test_button_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="5dp"
        android:paddingTop="20dp"
        android:src="@drawable/back" >
     </ImageView>

     <ImageView
        android:id="@+id/test_button_image2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:paddingLeft="5dp"
        android:paddingRight="15dp"
        android:paddingTop="15dp"
        android:src="@drawable/options1" />
     </RelativeLayout>

  <TextView
    android:id="@+id/ElemenrySchool"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@+id/btnback"
    android:paddingBottom="10dp"
    android:paddingLeft="5dp"
    android:paddingTop="10dp"
    android:text="elementry"
    android:textSize="17dp" >
     </TextView>

  <LinearLayout
    android:id="@+id/lytContent"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:background="@drawable/border2"
    android:orientation="vertical"
    android:paddingLeft="10dp"
    android:paddingRight="10dp" >

    <ListView
        android:id="@+id/listMainMenu11"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:dividerHeight="1dip"
        android:fadeScrollbars="true"
        android:listSelector="@drawable/listview_selector" />
       </LinearLayout>

    <TextView
    android:id="@+id/MiddleSchool"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingBottom="10dp"
    android:paddingLeft="5dp"
    android:paddingTop="10dp"
    android:text="Middle"
    android:textSize="17dp" >
   </TextView> …
Run Code Online (Sandbox Code Playgroud)

android

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

验证需要验证.您需要登录Google Play帐户.在应用内结算

我有一个错误

验证需要验证.您需要登录Google Play帐户.

同时使用测试帐户在我的设备上测试应用内结算.

我已经实现了应用程序内的计费v3,我已经在开发者控制台中上传了签名的 apk作为草稿apk并在我的设备中运行更高版本签名的apk.

android in-app-billing

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

Android SeekBar 中不需要的填充

我在使用 Android 搜索栏时遇到问题,搜索栏视图似乎有默认填充,我似乎无法删除它,我尝试将填充设置为“0dp”并尝试将边距设置为“-10dp”以查看它是否删除了一些空间并尝试将背景设置为空,以防背景占用空间但似乎没有发生任何事情,SeekBar 标签是:

<SeekBar
    android:paddingLeft="0px"
    android:paddingRight="0px"
    android:background="@null"
    android:id="@+id/musicSeekBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)

编辑:好的,经过一些测试和尝试一些东西后我学到了这一点:

  1. 填充是由于拇指可绘制尺寸决定的
  2. 设置android:thumb="@null"将删除底部和顶部填充
  3. 即使我移除拇指,左右填充仍然保留,但可以通过在两侧设置负边距等于默认拇指可绘制宽度除以 2 来移除,因此如果其 32dp,则每侧为 16dp

现在我需要知道是否有更干净的方法来去除填充以及所有设备上的拇指尺寸是否相同?欢迎任何帮助。

android seekbar

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

如何在HTTP post请求的消息体中附加XML文件?

如何在HTTP post请求的消息体中附加XML文件?

任何人都可以举例说明这种情况

java android

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

获取在doinbackground传递给asynctask的arraylist值

我有一个Asynctask设置我传递这样的Arraystring

ArrayList<String> creds = new ArrayList<String>();
creds.add(string1);
creds.add(string2);
new myasynctask().execute(credentials);
Run Code Online (Sandbox Code Playgroud)

asynctask方法 类myasynctask扩展AsyncTask,Integer,String>

DOinbackground

protected String doInBackground(ArrayList<String>... creds) 

            {       String lol1= creds[0].toString();
                    String lol2= creds[1].toString();
........rest of the code

}
Run Code Online (Sandbox Code Playgroud)

我从债券异常中得到一个数组索引如何将两个值传递给doinbackground方法并立即获取它们.

java arrays android android-asynctask

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

在libGDX中绘制线条动画

我在libGdx做第一场比赛.我必须像这个视频一样做线条画动画

这是我绘制的代码

Vector2 start = new Vector2(10, 10);
Vector2 end = new Vector2(100,100);
ShapeRenderer shapeRenderer=new ShapeRenderer();
shapeRenderer.setProjectionMatrix(cam.combined);
shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
shapeRenderer.setColor(Color.BLACK);
shapeRenderer.line(start, end);
shapeRenderer.end();
Run Code Online (Sandbox Code Playgroud)

我能够画2点之间的直线,但需要绘制动画.

任何帮助?

android libgdx

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