㈠ android 上下滑动按钮 按钮图片翻转180度从正面到反面 再滑动回到正面 如此循环 就代码 先谢谢了
代码没有,没实现过类似需求。
上下滑动按钮是类似UC浏览器中看小说的那种,点击可以向上滚动一屏内容的?这个暂时没实现思路。回头有时间看看。
图片翻转180从正面到反面这个Android API Demo里面就有,你开个模拟器,打开Views——>Animation——>3D Transition这里面第一个就是翻转效果,导入API Demo代码到Eclipse你就可以看源码了。
㈡ 怎样实现android页面滚动
除了嵌套滚动属性的控件外,比如ListView,WebView,EditText等外,想要让某个页面滚动,需要在布局中添加ScrollView控件
一个ScrollView控件只允许声明一个子控件
通常在一个ScrollView控件中嵌套LinearLayout
如果当前布局没有嵌套ScrollView,建议更改一下布局,实现滚动效果
㈢ 如何解决Android中WebView上下滑动事件
getScrollY()方法返回的是当前可见区域的顶端距整个页面顶端的距离,也就是当前内容滚动的距离。
getHeight()或者getBottom()方法都返回当前webview这个容器的高度
getContentHeight返回的是整个html的高度,但并不等同于当前整个页面的高度,因为webview有缩放功能,所以当前整个页面的高度实际上应该是原始html的高度再乘上缩放比例。
因此,更正后的结果,准确的判断方法应该是:
if(webview.getContentHeight*webview.getScale() -(webvi ew.getHeight()+webview.getScrollY())){
//已经chǔ于底端
}
㈣ android开发app怎么上下滑动
如果是布局,使用scrollview
如果是数据陈列,使用自定义listview
以上两种布局,都是在数据超出屏幕高度时,实现上下滚动
㈤ android实现上下滑动
布局最外包一层滚动条
java"><ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
强制横竖屏
在配置文件中对Activity节点添加android:screenOrientation属性(landscape是横向,portrait是纵向)
㈥ 安卓系统桌面循环滚动桌面设置的
1、手机设置”的“辅助功能”中有选择是否“桌面循环”。
2、在原生的android源码上添加这一功能。
思路:先把界面做出来,再将是否选择的值存到系统的(adb shell进入)data/data/com.android.providers.settings/databases/settings.db数据库中的system表中,
然后在Launch2的源码中取得数据库中是否选择循环桌面来执行相关代码。
先做UI:
在settings源码中的accessibility_settings.xml文件中添加一个checkbox:
java代码
android:key="launch_repeat"
android:title="@string/launch_repeat_title"
android:persistent="false"/>
在settings源码的res中添加相关的代码:
在values/string.xml中添加(英文显示):
Launch Repeat
在values-zh-rCN/string.xml中添加(中文显示):
"循环桌面"
在settings源码的AccessibilitySettings.java中的OnCreate中添加:
java代码
/*****************************************/
mLaunchRepeat=(CheckBoxPreference) findPreference(
LAUNCH_REPEAT);
int LaunchRepeat=Settings.System.getInt(this.getContentResolver(),
"launch_repeat",0);//取出是否被选择
if(LaunchRepeat==1)//如果被选择,那么下次打开setting时就勾选
mLaunchRepeat.setChecked(true);
else
mLaunchRepeat.setChecked(false);//如果没被选择,那么下次打开setting时就不勾选
/*****************************************/
当然还要定义几个量:
private final String LAUNCH_REPEAT =
"launch_repeat";
private CheckBoxPreference mLaunchRepeat;
在onPreferenceTreeClick函数中添加:
java代码
//add by xxnan
if(LAUNCH_REPEAT.equals(key))
{
Settings.System.putInt(getContentResolver(),
"launch_repeat",
((CheckBoxPreference) preference).isChecked()?
1:0);//将是否选择存到系统的system表中
}
//add by xxnan
如果做好了之后当点击选择“桌面循环时”可以到(adb shell进入)data/data/com.android.providers.settings/databases下的settings.db数据库(sqlite3 settings.db)的system
表中看到33|launch_repeat|1(select * from system;)。
到这里就完成了将数据存到系统system表中以及UI,接下来就是在Launch2源码中去取这个值(是否循环)。
到Launcher2源码中去找到Workspace.java文件,在里面有相应的修改:
在onTouchEvent中,之前有修改循环,如下:
java代码
case MotionEvent.ACTION_UP:
if (mTouchState == TOUCH_STATE_SCROLLING) {
final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
final int velocityX = (int)
velocityTracker.getXVelocity(mActivePointerId);
final int screenWidth = getWidth();
final int whichScreen = (mScrollX + (screenWidth / 2)) / screenWidth;
final float scrolledPos = (float) mScrollX / screenWidth;
Log.i("velocityX","velocityX="+velocityX+"whichScreen="+whichScreen);
/***********************************************/
//modifided by xxnan
if (velocityX > SNAP_VELOCITY) {
// Fling hard enough to move left.
// Don't fling across more than one screen at a time.
Log.i("numscreen","numscreen="+mCurrentScreen);
/* final int bound = scrolledPos < whichScreen ?
( (mCurrentScreen+ getChildCount()) - 1 )% getChildCount():
mCurrentScreen;*/
final int bound =( (mCurrentScreen+ getChildCount()) - 1 )% getChildCount()
;
Log.i("numscreen","bound="+bound);
snapToScreen( bound, velocityX, true);
} else if (velocityX < -SNAP_VELOCITY ) {
// Fling hard enough to move right
// Don't fling across more than one screen at a time.
/*final int bound = scrolledPos > whichScreen ?
( mCurrentScreen + 1 )% getChildCount(): mCurrentScreen;*/
final int bound = ( mCurrentScreen + 1 )% getChildCount() ;
snapToScreen(bound, velocityX, true);
} else {
snapToScreen(whichScreen, 0, true);
}
/***********************************************/
//下面是原生代码
/*if (velocityX > SNAP_VELOCITY && mCurrentScreen > 0) {
// Fling hard enough to move left.
// Don't fling across more than one screen at a time.
final int bound = scrolledPos < whichScreen ?
mCurrentScreen - 1 : mCurrentScreen;
snapToScreen(Math.min(whichScreen, bound), velocityX, true);
} else if (velocityX < -SNAP_VELOCITY && mCurrentScreen <
getChildCount() - 1) {
// Fling hard enough to move right
// Don't fling across more than one screen at a time.
final int bound = scrolledPos > whichScreen ?
mCurrentScreen + 1 : mCurrentScreen;
snapToScreen(Math.max(whichScreen, bound), velocityX, true);
} else {
snapToScreen(whichScreen, 0, true);
}*/
}
mTouchState = TOUCH_STATE_REST;
mActivePointerId = INVALID_POINTER;
releaseVelocityTracker();
break;
那么就要在修改的地方加一个判断,如果system中取得的值是1,就可以循环,如果是0,就不能。
代码修改如下:
java代码
case MotionEvent.ACTION_UP:
if (mTouchState == TOUCH_STATE_SCROLLING) {
final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
final int velocityX = (int)
velocityTracker.getXVelocity(mActivePointerId);
final int screenWidth = getWidth();
final int whichScreen = (mScrollX + (screenWidth / 2)) / screenWidth;
final float scrolledPos = (float) mScrollX / screenWidth;
Log.i("velocityX","velocityX="+velocityX+"whichScreen="+whichScreen);
/***********************************************/
//modifided by xxnan 2013-1-9
launch_repeat=Settings.System.getInt(mContext.getContentResolver(),
"launch_repeat",0);//取出system表中“launch_repeat”的值
Log.i(" launch_repeat"," launch_repeat="+ launch_repeat);
if(launch_repeat==1)//如果是1,就循环,也就是之前已经改好的
{
if (velocityX > SNAP_VELOCITY) {
// Fling hard enough to move left.
// Don't fling across more than one screen at a time.
Log.i("numscreen","numscreen="+mCurrentScreen);
/* final int bound = scrolledPos < whichScreen ?
( (mCurrentScreen+ getChildCount()) - 1 )% getChildCount():
mCurrentScreen;*/
final int bound =( (mCurrentScreen+ getChildCount()) - 1 )% getChildCount()
;
Log.i("numscreen","bound="+bound);
snapToScreen( bound, velocityX, true);
} else if (velocityX < -SNAP_VELOCITY ) {
// Fling hard enough to move right
// Don't fling across more than one screen at a time.
/*final int bound = scrolledPos > whichScreen ?
( mCurrentScreen + 1 )% getChildCount(): mCurrentScreen;*/
final int bound = ( mCurrentScreen + 1 )% getChildCount() ;
snapToScreen(bound, velocityX, true);
} else {
snapToScreen(whichScreen, 0, true);
}
}
else//如果是0,那么就是原生代码,不循环
{
if (velocityX > SNAP_VELOCITY && mCurrentScreen > 0) {
// Fling hard enough to move left.
// Don't fling across more than one screen at a time.
final int bound = scrolledPos < whichScreen ?
mCurrentScreen - 1 : mCurrentScreen;
snapToScreen(Math.min(whichScreen, bound), velocityX, true);
} else if (velocityX < -SNAP_VELOCITY && mCurrentScreen <
getChildCount() - 1) {
// Fling hard enough to move right
// Don't fling across more than one screen at a time.
final int bound = scrolledPos > whichScreen ?
mCurrentScreen + 1 : mCurrentScreen;
snapToScreen(Math.max(whichScreen, bound), velocityX, true);
} else {
snapToScreen(whichScreen, 0, true);
}
}
/***********************************************/
//下面是原生代码
/*if (velocityX > SNAP_VELOCITY && mCurrentScreen > 0) {
// Fling hard enough to move left.
// Don't fling across more than one screen at a time.
final int bound = scrolledPos < whichScreen ?
mCurrentScreen - 1 : mCurrentScreen;
snapToScreen(Math.min(whichScreen, bound), velocityX, true);
} else if (velocityX < -SNAP_VELOCITY && mCurrentScreen <
getChildCount() - 1) {
// Fling hard enough to move right
// Don't fling across more than one screen at a time.
final int bound = scrolledPos > whichScreen ?
mCurrentScreen + 1 : mCurrentScreen;
snapToScreen(Math.max(whichScreen, bound), velocityX, true);
} else {
snapToScreen(whichScreen, 0, true);
}*/
}
mTouchState = TOUCH_STATE_REST;
mActivePointerId = INVALID_POINTER;
releaseVelocityTracker();
break;
当然这里面也要定义几个量,以及导入几个包:
导入包:
//add by xxnan
import android.content.ContentResolver;//从system表中取数据
import android.provider.Settings;
定义变量:
private int launch_repeat;//取得是否循环的值
到这里就全部修改好了,还有就是编译一下源码中的package/apps的Launch2和Settings的源码,将生成的out/target/。。。/system/app下的
Launch2.apk和Settings.apk替换手机里system/app的这两个apk就可以了。
㈦ android开发图片(ImageView)要实现循环匀速滚动,速度可调,怎么实现呢,用什么组件好呢
采用画廊视图,GalleryView,自动匀速定时切换的话可以使用Timetask。网上搜一搜,很多案例。望采纳。
㈧ Android Studio怎么做可以上下滚动的界面
上下滚动的界面是用ScrollView 来实现的
左右滚动的界面是用 HorizontalScrollView来实现的
这两个控件,当子控件超过了屏幕,就可以上下或者左右的滚动来展示
㈨ 荣耀30s手机桌面循环滑动怎么设置
桌面循环滑动设置方法如下:
1、在桌面空白处,双指捏合屏幕可以进去桌面管理。
2、点击设置。
3、将循环滑动功能开启即可。
扩展
荣耀30S手机很不错,参数如下:
1、屏幕:屏幕尺寸6.5英寸,屏幕色彩1670万色,看电影更加舒畅。
2、相机:后置四摄6400万像素+800万像素+800万像素+200万像素,支持自动对焦。前置1600万像素,支持固定焦距。
3、性能:采用Magic UI 3.1.1(基于Android 10)系统,搭载HUAWEI Kirin 820 (麒麟820),八核处理器 ,带来高速、流畅的体验。
4、电池:配备4000mAh(典型值)大容量电池,续航持内久。
㈩ android如何利用horizon scrollview实现循环滚动
把要滚动的布局放在scrollview里面,