android移动view之后刷新布局导致移动后的view归回原位置2
来源:互联网 发布:巫妖王之怒数据库 编辑:程序博客网 时间:2024/04/30 13:03
接上篇
布局文件
<!--<TextView--> <!--android:id="@+id/tt"--> <!--android:layout_width="wrap_content"--> <!--android:layout_height="wrap_content"--> <!--android:text="test" />--><!--<ImageView--> <!--android:layout_width="60dp"--> <!--android:layout_height="60dp"--> <!--android:layout_centerInParent="true"--> <!--android:src="@drawable/app" />--><!--<ImageView--> <!--android:id="@+id/ii"--> <!--android:layout_width="60dp"--> <!--android:layout_height="60dp"--> <!--android:layout_centerInParent="true"--> <!--android:src="@drawable/controlset_ic_launcher" />--><!--<LinearLayout--> <!--android:layout_width="match_parent"--> <!--android:layout_height="wrap_content"--> <!--android:layout_alignParentBottom="true"--> <!--android:gravity="center"--> <!--android:orientation="horizontal">--> <!--<Button--> <!--android:id="@+id/Move"--> <!--android:layout_width="match_parent"--> <!--android:layout_height="wrap_content"--> <!--android:layout_weight="1"--> <!--android:text="移动"--> <!--android:textSize="20sp" />--> <!--<Button--> <!--android:id="@+id/MoveBack"--> <!--android:layout_width="match_parent"--> <!--android:layout_height="wrap_content"--> <!--android:layout_weight="1"--> <!--android:text="退回"--> <!--android:textSize="20sp" />--><!--</LinearLayout>-->
使用
public class MainActivity extends Activity {
int count;TextView tt;ImageView iv;int dFX = 0, dTX = 50, dFY = 0, dTY = 50;RefreshRelativeLayout mapViewRelativeLayout;Button mMove;Button mMoveBack;Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 0:
// iv.layout(l, t, r, b);
break;
case 1:
tt.setText(count++ + “”);
break;
}
}};@Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mapViewRelativeLayout = (RefreshRelativeLayout) findViewById(R.id.MapView_Layout); tt = (TextView) findViewById(R.id.tt); iv = (ImageView) findViewById(R.id.ii); mMove = (Button) findViewById(R.id.Move); mMoveBack = (Button) findViewById(R.id.MoveBack); mMove.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mapViewRelativeLayout.setTargetViewLayout(dFX, dTX, dFY, dTY, 1000, 100, false); } }); mMoveBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mapViewRelativeLayout.setTargetViewLayout(dFX, -dTX, dFY, -dTY, 1000, 100, false); } }); new Thread(new Runnable() { @Override public void run() { while (true) { handler.sendEmptyMessage(1); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }).start();}
0 0
- android移动view之后刷新布局导致移动后的view归回原位置2
- android移动view之后刷新布局导致移动后的view归回原位置1
- 移动View位置时,修改图片资源导致View在原位置闪烁的问题
- 移动 view 的位置
- Android-->View.setX()和.setY()的使用(移动布局,设置布局位置,动态添加View)
- 移动View试图位置
- android移动View位置(动画)
- Android抽屉效果(使用LayoutParams来移动View的位置)
- Android移动view动画问题 关于view的位置移动了,但view里面绑定的监听器还在原位
- Android移动view动画问题 关于view的位置移动了,但view里面绑定的监听器还在原位
- Android移动view动画问题 关于view的位置移动了,但view里面绑定的监听器还在原位
- Android移动view动画问题 关于view的位置移动了,但view里面绑定的监听器还在原位
- android移动view
- android view 移动
- android view移动总结
- android 移动view
- android移动View
- Android的View绘图并移动
- java的JDK、JRE、JVM的区别和联系
- 11.27sission总结
- android移动view之后刷新布局导致移动后的view归回原位置1
- Xml.
- LeetCode题解:Nim Game
- android移动view之后刷新布局导致移动后的view归回原位置2
- Objective-C的m文件中定义变量
- 07-渲染流程-5-Sprite渲染-QuadCommand
- mybatis示例
- 第十九节 协议栈五向按键
- java.lang.NumberFormatException: For input string: "undefined"
- segment视图切换
- xml的用途
- union, struct, enum 的 大小区别