小编Rad*_*hey的帖子

listview与表格布局

我正在开发一个活动,其中我使用列表视图与表格布局.我想在列表视图中显示图像和文本,但问题是图像显示略微超出列表顺序

 img1        text1                              img1    text1
  img2       text2     and i want this          img2    text2
 img3        text3                              img3    text3
 img4        text4                              img4    text4
 img5        text5                              img5    text5
Run Code Online (Sandbox Code Playgroud)

这样..所以关于列表视图或图像视图的属性的任何想法,以正确设置它?那么PLZ评论......

list_row.xml

    <?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="?android:attr/listPreferredItemHeight"
    android:background="#ffffff"
    android:padding="6dip" >

    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:background="#ffffff"
        android:stretchColumns="*" >

        <TableRow>

            <ImageView
                android:id="@+id/icon"
                android:layout_gravity="left"
                android:background="#ffffff"
                android:padding="2dip" />

            <TextView
                android:id="@+id/description"
                android:background="#ffffff"
                android:padding="2dip"
                android:singleLine="true"
                android:textColor="#000000"
                android:textSize="12sp" />
        </TableRow>
    </TableLayout>

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

main.xml中

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



    <ListView
        android:id="@+id/android:list"
        android:background="#ffffff"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:dividerHeight="1dip"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android listview tablelayout

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

从谷歌方向API解析JSON

我想在谷歌地图上从起点到终点逐步解析.解析我使用以下链接:

Google Map Direction API

在那个链接我想解析"机动"json数组.

如何从json文件中逐步获取方向,我应该在哪里更改为我的代码? 提前使用thanx ...除此之外我的代码显示如下:

public class **DirectionsJSONParser** {

    /** Receives a JSONObject and returns a list of lists containing latitude and longitude */
    public List<List<HashMap<String,String>>> parse(JSONObject jObject){

        List<List<HashMap<String, String>>> routes = new ArrayList<List<HashMap<String,String>>>() ;
        JSONArray jRoutes = null;
        JSONArray jLegs = null;
        JSONArray jSteps = null;    

        try {           

            jRoutes = jObject.getJSONArray("routes");

            /** Traversing all routes */
            for(int i=0;i<jRoutes.length();i++){            
                jLegs = ( (JSONObject)jRoutes.get(i)).getJSONArray("legs");
                List path = new ArrayList<HashMap<String, String>>();

                /** Traversing all legs */
                for(int j=0;j<jLegs.length();j++){ …
Run Code Online (Sandbox Code Playgroud)

parsing android json direction

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

ANDROID:java.lang.NoSuchMethodError:org.apache.commons.codec.binary.Base64.encodeBase64String in android

想要为oauth登录生成签名.因为我使用了HmacSHA1和base64 algo.please看看下面代码的东西.我已经访问了很多与之相关的链接但是这给了java平台[ J2EE ]的解决方案而不是Android.同名代码/方法工作正常并在java的eclipse中生成签名但它在android中抛出错误.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Random;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;


import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;



import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View; …
Run Code Online (Sandbox Code Playgroud)

eclipse base64 android oauth signature

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

java.lang.UnsupportedClassVersionError:com/android/build/gradle/AppPlugin:不支持的major.minor版本52.0

我正在使用Jenkins创建构建.我做了什么形成了我的一面:

  1. 我在MAC系统上设置了Jenkins(mac os el capitan)
  2. 配置android sdk
  3. 链接我想要创建构建的项目形式Git-hub

在构建项目时,我得到了不支持的major.minor版本52.0错误.我已经参考了几个SO解决方案来修复此错误并且还更新到JDK8但没有运气!

我想知道的是,我是否也应该在这里设置jdk的路径,

Jenkins->管理Jenkins->全局工具配置 - > JDK

或任何人有任何其他解决方案来解决这个问题?任何参考链接或帮助都会很明显,谢谢.这是错误消息>

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/Shared/Jenkins/Home/workspace/UserModual/app/build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'. java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Run Code Online (Sandbox Code Playgroud)

java git macos android jenkins

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

标签 统计

android ×4

base64 ×1

direction ×1

eclipse ×1

git ×1

java ×1

jenkins ×1

json ×1

listview ×1

macos ×1

oauth ×1

parsing ×1

signature ×1

tablelayout ×1