小编Nei*_*eil的帖子

修改Android搜索栏小部件以垂直操作

我试图让一个垂直的搜索栏与模拟器一起运行,但我有点卡住了.我可以让搜索栏显示我想要的方式,我可以获得进展以做我想要的,我可以修改onTouchEvent以使拇指垂直而不是水平移动.我不能做的是让拇指移动到默认的29个水平像素之外而不使用setThumbOffset().这本身不是问题.问题来自于我根本不理解thumbOffset这一事实 - 我猜.我想我可以(正确地)调整小部件的大小,我很确定我做得不对.或者也许我可以使用thumbOffset,如果我能搞清楚的话.由于我可以正确地计算进度,我以为我只会使用小部件的进度*(getTop() - getBottom())的线性函数,但似乎没有这样做.但我无法弄清楚偏移的中心位置.

在某种程度上,我真的不确定我在onSizeChanged()中所做的事情是否理智,或者是否会在以后咬我的屁股.

这是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" >

    <com.mobilsemantic.mobipoll.SlideBar
        android:id="@+id/slide"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:max="100"
        android:progress="0"
        android:secondaryProgress="25" />

        <Button android:id="@+id/button"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Hello, I am a Button" />

    <TextView android:id="@+id/tracking"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

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

和类(忽略调试垃圾):

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.SeekBar;

public class SlideBar extends SeekBar {

        private int oHeight = 320, oWidth = 29;
        private int oProgress = -1, oOffset = -1;;
        private float xPos …
Run Code Online (Sandbox Code Playgroud)

layout android widget seekbar

18
推荐指数
3
解决办法
4万
查看次数

DDMS不会加载(或不解析?)KML文件

我无法让DDMS加载任何KML文件.

我有一个KML文件,例如其中包含以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
 <Placemark>
   <name>Simple placemark</name>
   <description>Attached to the ground. Intelligently places itself
      at the height of the underlying terrain.</description>
   <Point>
     <coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
   </Point>
 </Placemark>
</kml>
Run Code Online (Sandbox Code Playgroud)

http://developer.android.com/guide/developing/tools/ddms.html上的文档 似乎表明我只需要启动我的应用程序并启动DDMS并加载KML.这不起作用.

我甚至尝试过在同一个链接上建议的Google Earth解决方案.

我正在使用SDK 1.5_r2.我做错了什么或遗失了什么?

android kml ddms

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

标签 统计

android ×2

ddms ×1

kml ×1

layout ×1

seekbar ×1

widget ×1