當前位置:首頁 » 安卓系統 » 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等子類中使用快速滾動輔助。

熱點內容
出售lol腳本防封判幾年 發布:2024-04-19 12:45:14 瀏覽:187
安卓電視會員和平板哪個好 發布:2024-04-19 12:42:48 瀏覽:834
雲伺服器2m寬是多少 發布:2024-04-19 11:56:36 瀏覽:728
android層布局 發布:2024-04-19 11:52:13 瀏覽:771
1500元組裝伺服器電腦 發布:2024-04-19 11:47:25 瀏覽:469
qq改密碼怎麼改手機 發布:2024-04-19 11:39:17 瀏覽:969
電腦上如何看wifi密碼 發布:2024-04-19 11:34:14 瀏覽:416
java性能測試腳本 發布:2024-04-19 11:25:24 瀏覽:981
存儲成本與性能 發布:2024-04-19 11:16:18 瀏覽:169
linux根文件系統製作 發布:2024-04-19 11:16:12 瀏覽:747