小编Bit*_*tel的帖子

在android中拖放具有多种布局的自动滚动

“当我拖放具有多个布局的图像时,自动滚动效果不佳”

我到处搜索,但找不到解决方案。我从这个链接得到了一个解决方案:

在 Android 中通过拖放进行滚动视图自动滚动

@thehayro 感谢提供这么好的例子。

但它仅适用于一种布局,并且自动滚动也有效。但是我在一个线性布局中有超过 4-5 个子布局,并且此布局在滚动视图中,我的布局文件如下所示:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.example.dragvdropdemo.MyScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/scroll_view">
<LinearLayout 
 android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/lldrag">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="200dip" 
    android:id="@+id/ll1"
    android:layout_marginTop="10dip"
     android:background="@android:color/darker_gray">

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/dr_logo" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:id="@+id/imageView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/fb" />

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="200dip" 
    android:id="@+id/ll2"
    android:layout_marginTop="10dip"
    android:background="@android:color/darker_gray">


    <ImageView
        android:id="@+id/ImageView01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/twitter" />

    <ImageView
        android:id="@+id/ImageView02"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:id="@+id/ImageView03"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="200dip" 
    android:id="@+id/ll3"
    android:layout_marginTop="10dip" …
Run Code Online (Sandbox Code Playgroud)

android drag-and-drop android-scrollview

3
推荐指数
1
解决办法
3789
查看次数

在java中剪切字符串而不破坏单词的中间部分

如何在一个单词的中间截断一个没有剪切的文本?

例如,我有字符串:

"一种全新的生活方式本身就会出现.再一次,你有一个良好的开端,愿意在你的结果导向的心态中做一点点额外的努力.这不是努力的结果,而是结果对你来说很重要.你在生活中的浪漫和情感纽带中也获得了很多.这是自我提升计划或慈善事业,施舍和慈善事业的好时机."

如果我切它,我想像这样切:

"一种全新的生活方式本身就会出现.再一次,你有一个良好的开端,愿意在你的结果导向的心态中做一点点额外的努力.这不是努力的结果,而是结果对你来说很重要.你在浪漫的深度上也获得了很多,"

并不是 :

"一种全新的生活方式本身就会出现.再一次,你有一个良好的开端,愿意在你的结果导向的心态中做一点点额外的努力.这不是努力的结果,而是结果对你来说很重要.你在浪漫和情感的深度上也获得了很多"

java regex android

3
推荐指数
1
解决办法
3333
查看次数

标签 统计

android ×2

android-scrollview ×1

drag-and-drop ×1

java ×1

regex ×1