以线性布局对齐2个图像

时间:2017-06-13 09:54:12

标签: android android-linearlayout

我想在线性布局中将右侧的2个图像对齐。如何在2个图像之间添加空间? 这是我的代码。

Vechile.xml

for(char alph = 'A'; alph <= 'Z'; alph++){
List<String> friends = getFriends(alph);

if(friends.size() > 0){
//Populate the Sorted Alphabetical view
}
 }

private List<String> getFriends(char alph) {
//Empty List used to populate when comparing existing model to alphabet
List<String> friends = new ArrayList<>();

//5 objects of FriendsData with three parameters
for (int i = 0; i < friendsData.size(); i++){
//If the first string parameter character at position 0 is equal to alph
 String username=friendsData.get(i).getUsername();      //get the username
 if(username.charAt(0) == alph){                        //compare the username with charater in alph variable
 friends.add(username);                                 //add in another list
}
 }

return friends;
}

1 个答案:

答案 0 :(得分:0)

将LinearLayout重力设置为右,并在ImageViews中取一些余量,如下所示:

  java.lang.RuntimeException: Can't create handler inside thread that has 
  not called Looper.prepare()
 W/System.err:     at android.os.Handler.<init>(Handler.java:200)
 W/System.err:     at android.os.Handler.<init>(Handler.java:114)
 W/System.err:     at android.widget.Toast$TN.<init>(Toast.java:345)
 W/System.err:     at android.widget.Toast.<init>(Toast.java:100)
 W/System.err:     at android.widget.Toast.makeText(Toast.java:256)
 W/System.err:     at com.services.FileDownloadService$RegrowCornAnimate.run
 (FileDownloadService.java:252)
 W/System.err:     at java.util.Timer$TimerImpl.run(Timer.java:284)