当前位置:首页 » 安卓系统 » android拖动

android拖动

发布时间: 2022-01-25 11:24:50

1. android拖动照片来回移动怎么实现

监听touch事件,action_move里面写 更改图片位置为手指位置就行了

2. android布局 按钮不能 自由拖动

因为你的layout类型选了linearlayout或者gridlayout了对不对。。。
如果想要拖动,建议换成releativelayout

不要用拖动按钮的方法去布局。正经的布局都是在xml里敲代码的。拖动这个习惯该改改了。

3. android startDrag() 和 OnDragListener 如何设置被拖动View的移动范围

这个好像暂时都是靠技术的,目前还没有这项设置。我查了一下,没找到,或许有但是我不知道吧呵呵。

4. android 里怎么随意拖动按钮

可参考如下代码即可:

java"><LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>

5. 如何使用Android的拖拽接口实现拖拽功能

可参考如下代码即可:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>

6. android关于拖动imageview

要拖动星星在onTouch事件里面处理就行了啊

7. android 拖动imageview 如果没有拖动到指定的位置 返回到起点怎么实现

scaletype属性用FITXY 就是把图片布满View,固定了,我想问你怎样ImageView的拖动效果和点击事件

8. Android的对话框可以实现可拖动么

一句就可以显示对话框。我们在调试程序的时候用,是来检查自己程序,走到这步是否正确的检查。没有什么步骤说法。1是显示系统语法错误。2是自己写提示语。自己写在提示框的文本就ok了。

9. android拖动控件的界面怎么没了

1. 使用控件的layout 方法。

可以改任意位置和大小,不受布局限制。 但是在使用 setText等方法之后,会导致 界面重新布局,控件会回到原来位置

[java] view plainprint?
01.btnMove.layout(left, top, left + 80, top+50);
btnMove.layout(left, top, left + 80, top+50);

2. 使用控件的setLayoutParams 方法,改变布局参数。

很容易改大小,设置Height 和 Width 即可

改位置会受到布局限制。要改到任意位置的话,须将控件放置在 FrameLayout 中,并设置 android:layout_gravity="top"

[java] view plainprint?
01.int left = btnMoveLayoutB.getLeft() + 50;
02.int top = btnMoveLayoutB.getTop() + 120;
03.
04.FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)btnMoveLayoutB.getLayoutParams();
05.params.setMargins(left, top, 3, 3);//改变位置
06.btnMoveLayoutB.setLayoutParams(params);

10. android手动拖动滚动条高速滑动怎么解决

android手动拖动滚动条快速滑动

只需在ListView中加入一个参数
android:fastScrollEnabled="true" android:focusable="true"
android的源代码如下:
在contacts_list_content.xml中:
<com.android.contacts.FocusRequestingListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fastScrollEnabled="true"
/>
而FocusRequestingListView 的源代码如下:
public class FocusRequestingListView extends ListView {
private boolean mFirstLayoutDone = false;
public FocusRequestingListView(Context context) {
super(context);
}
public FocusRequestingListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FocusRequestingListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (!mFirstLayoutDone) {
setFocusable(true);
requestFocus();
}
mFirstLayoutDone = true;
}
}
其实有用的就这么两句话,
if (!mFirstLayoutDone) {
setFocusable(true);
requestFocus();
}
mFirstLayoutDone = true;
说的意思就是在什么情况下设置focusable焦点。

很多开发者不知道ListView列表控件的快速滚动滑块是如何启用的,这里Android开发网告诉大家,辅助滚动滑块只需要一行代码就可以搞定,如果你使用XML布局只需要在ListView节点中加入 android:fastScrollEnabled="true" 这个属性即可,而对于Java代码可以通过myListView.setFastScrollEnabled(true); 来控制启用,参数false为隐藏。

还有一点就是当你的滚动内容较小,不到当前ListView的3个屏幕高度时则不会出现这个快速滚动滑块,同时该方法仍然是AbsListView的基础方法,可以在ListView或GridView等子类中使用快速滚动辅助。

热点内容
python经典程序实例 发布:2024-05-02 09:42:07 浏览:260
酷丰c10出厂密码多少 发布:2024-05-02 09:23:33 浏览:376
开发安卓游戏需要会什么 发布:2024-05-02 09:04:22 浏览:977
无线网密码忘了手机怎么改 发布:2024-05-02 08:57:24 浏览:527
iis上传文件权限设置 发布:2024-05-02 08:56:39 浏览:232
ipad文件加密 发布:2024-05-02 08:20:30 浏览:443
粉土压缩模量 发布:2024-05-02 07:53:59 浏览:806
国都证券初始密码是多少 发布:2024-05-02 07:46:39 浏览:110
shell脚本和linux命令行 发布:2024-05-02 07:37:54 浏览:968
自己的服务器搭建微信小程序商城 发布:2024-05-02 07:36:26 浏览:427