在Android Studio中,图像未在预览中显示

时间:2018-01-06 13:29:19

标签: image android-layout imageview preview android-studio-3.0

我在 AndroidStudio 中使用 package application; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.text.ParseException; public class T { public static void main(String[] args) throws ParseException { String filename="location.txt"; Path pathToFile = Paths.get(filename); FileWriter fstream = null; BufferedWriter bw=null; PrintWriter pw=null; try { fstream = new FileWriter(filename, true); bw=new BufferedWriter(fstream); pw=new PrintWriter(bw); } catch (IOException e) { e.printStackTrace(); } StringBuilder sb = new StringBuilder(); try (BufferedReader br = Files.newBufferedReader(pathToFile, StandardCharsets.US_ASCII)) { String line = br.readLine(); while (line!=null) { String[] attributes = line.split(" "); System.out.print("Sensor["+attributes[0]+"] : "); double x=Double.parseDouble(attributes[1]); double y=Double.parseDouble(attributes[2]); GeoHash geoCode=GeoHash.withCharacterPrecision(x, y, 10); System.out.print(geoCode+"\n"); pw.println(line+" "+geoCode); sb.append(line+" "+geoCode); line = br.readLine(); } PrintWriter writer = new PrintWriter(filename); writer.print(""); writer.close(); br.close(); pw.close(); bw.close(); fstream.close(); } catch (IOException ioe) { ioe.printStackTrace(); } System.out.println("Generated!!"); } } AndroidStudio 并未在预览中显示我的图片。请找到以下屏幕截图:

Screen shot

1 个答案:

答案 0 :(得分:0)

转到styles.xml并添加“ Base”,如下所示。

enter image description here

希望对您有帮助!