小编use*_*443的帖子

如何只获得城市,州,国家从lat,长在android

我有以下代码将lat,long转换为人类可读的地址.现在我获得包括街道名称在内的全部细节.我怎样才能得到城市,州,国家?我不想要任何更多细节.请帮我.

Geocoder geoCoder = new Geocoder(getBaseContext(), Locale.getDefault());
try {
   List<Address> addresses = geoCoder.getFromLocation(latitude, longitude, 1);

   String add = "";
   if (addresses.size() > 0) 
   {
      for (int i=0; i<addresses.get(0).getMaxAddressLineIndex();i++)
     add += addresses.get(0).getAddressLine(i) + "\n";
   }

   showToastMessage(add);
}
catch (IOException e1) {                
   e1.printStackTrace();
}   
Run Code Online (Sandbox Code Playgroud)

android street-address google-geocoder

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

Android中Imageview的圆角

我在linearlayout中有一个textview和imageview.Textview位于顶部,imageview位于底部.我使用下面的线条为linearlayout设置了圆角.但是imageview角落并没有四舍五入.我看到只有linearlayout的顶角是圆形的.我如何才能获得imageview的圆角?(如果删除imageview,我看到所有的角都是圆角的)

rounded_corners.xml

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

<solid android:color="#ffffff" />


<corners
    android:bottomLeftRadius="8dp"
    android:bottomRightRadius="8dp"
    android:topLeftRadius="8dp"
    android:topRightRadius="8dp" />

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

main.xml中

  <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="50dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="50dp"
    android:background="@xml/rounded_corners"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="xxxxxxxx" />

    <ImageView     
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scaleType="centerCrop"
        android:src="@drawable/my_image_view" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

屏幕截图: 在此输入图像描述

android rounded-corners imageview android-linearlayout

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

如何在真实设备上运行Android应用程序?

我是android的新手..任何人都可以告诉我如何在设备上运行应用程序..我已连接并启用设备上的USB调试并运行.但它始终只启动模拟器.我怎样才能在设备而不是模拟器上运行?

eclipse android device

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