我正在使用最新的Android设计支持库,我的导航视图分为两组,一组用于我使用from math import sin, cos, sqrt, atan2, radians
coord=[]
coord1=None
def distance(coord1,coord2): #Haversin
lat1,lon1=coord1
lat2,lon2=coord2
dlat = radians(lat2-lat1)
dlon = radians(lon2-lon1)
a = sin(dlat/2) * sin(dlat/2)
+ cos(radians(lat1))*cos(radians(lat2))*sin(dlon/2)*sin(dlon/2)
c = 2 *atan2(sqrt(a),sqrt(1-a))
s = (6367*c)*1000 #meter
return s
# with open as data will close itself after reading each line. so you don't need to close it yourself
with open('asko_nav_2013.nmea', 'r') as indata: #making a indata and outdata, r stands for reading(readcapabilities
with open('asko_nav_out.txt', 'w') as outdata: #w stands for write write to a new file(open for writing-you can change things)
while True:
line = indata.readline()
if not line:
break
if line.startswith('EOL'): #if the line starts with EOL(end of line) it writes it in the output
outdata.writelines("EOL")
coord1=None
elif line.startswith('Line'):
LineID=line
outdata.writelines('\n%s' %LineID)
elif line.startswith('$GPGGA'): #when the fist line starts with $GPGGA it splits the columns
data=line.split(",") #the for loop reads the file line by line
# Importing only coordinates from asko input file (Row 2 and 4)
# Converting the coordinates from DDMM.MMMM to DD.DDDDDD
LAT=(data[2])
LAT_D=LAT[0:2]
LATID=float(LAT_D)
LAT_M=LAT[2:]
LATM=float(LAT_M)
LATIM = float(LATM) / 60.0
latitude=(LATID + LATIM)
LON=(data[4])
LON_D=LON[1:3]
LONGD=float(LON_D)
LON_M=LON[3:]
LONM=float(LON_M)
LONGM = float(LONM) / 60.0
longitude=(LONGD + LONGM)
if coord1 is None:
# The first time through the loop "coord1" is None
outdata.writelines('%0.6f\t%0.6f\t%s \n'%(latitude,longitude,0))
coord1=(latitude,longitude)
else:
coord2=(latitude,longitude)
dist=distance(coord1,coord2)
if dist <100:
continue
outdata.writelines('%0.6f\t%0.6f\t%f\n' % (latitude,longitude,dist))
coord1=coord2
的片段,一组用于设置和关于我在哪里使用android:checkableBehavior="single"
等活动。
这在图书馆的23.0.1版本中运行良好,现在当我使用android:checkableBehavior="none"
时,选择时会检查按钮。
这只是库中的错误还是我必须为新版本更改某些内容? 我在更改日志中找不到任何内容。
菜单:
compile 'com.android.support:design:+'
布局:
<group
android:id="@+id/main"
android:checkableBehavior="single">
<item
android:id="@+id/navigation_fragment_1"
android:icon="@drawable/icon"
android:title="@string/fragment_1" />
</group>
<group
android:id="@+id/sub"
android:checkableBehavior="none">
<item
android:id="@+id/navigation_sub_settings"
android:title="@string/settings" />
</group>
</menu>
答案 0 :(得分:1)
我的代码中有一个DATE
(这对旧版本没有任何问题),但我猜他们改变了一些东西,所以现在你可以手动检查menuItems,即使它们被设置为menuItem.setChecked(true);
。