小编Sri*_*dev的帖子

如何在android中创建循环imageButton?

伙计们我在我的布局文件中创建了一个imageButton并设置了一个圆形的png图像作为它的背景.但是当我运行我的应用程序时,它显示一个方形按钮,我的给定图像放在它的中间.

<ImageButton
    android:id="@+id/imageButton1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:src="@drawable/sliderr" />
Run Code Online (Sandbox Code Playgroud)

android android-layout

16
推荐指数
3
解决办法
4万
查看次数

一个接一个地在imageView中显示多个图像,重复从左到右翻转效果

假设我在drawable文件夹中有多个图像(ex-8图像).我希望一个接一个地在一个imageView中显示所有这些图像,并重复从左到右翻转效果(ex-img[0],img[1],……img[8],img[0],img[1],…………).我怎样才能做到这一点?

private void AnimateandSlideShow() {
    image1 = (ImageView)findViewById(R.id.imageView1);
    image1.setImageResource(img[currentimageindex1%img.length]);
    currentimageindex1++;
    Animation rotateimage = AnimationUtils.loadAnimation(this, R.anim.custom_anim);
    image1.startAnimation(rotateimage);         
}
Run Code Online (Sandbox Code Playgroud)

android

6
推荐指数
2
解决办法
3万
查看次数

在 Android 中应用移动动画后,单击操作在 Android 按钮中不起作用

伙计们,我设计了视图,我在该视图中添加了三个按钮。我已经为所有三个按钮提供了 on_click 功能。我的要求是,如果我单击按钮_1,则按钮_2 和按钮三应移动到新位置。但是,问题是,在将移动动画应用于 Button_2 后,button_3 on_click 设施在新位置上不起作用。

MainActivity.java

public class MainActivity extends Activity {

ImageButton slider,slidernew,sliderexisting;
boolean flag1 = true;
boolean flag2 = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //final LinearLayout container = (LinearLayout) findViewById(R.id.container);
    slider = (ImageButton) findViewById(R.id.imageButton1);
    slidernew = (ImageButton) findViewById(R.id.imageButton2);
    sliderexisting = (ImageButton) findViewById(R.id.imageButton3);

    // Set long default duration for the animator, for the purposes of this demo
    //animate(slidernew).setDuration(2000);
    slider.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            /*int xValue = container.getWidth() - …
Run Code Online (Sandbox Code Playgroud)

android android-animation android-button

5
推荐指数
1
解决办法
909
查看次数

没有“安全”属性的 HTTPS 会话中的敏感 Cookie

我在代码中通过 JS 设置 cookie 中的一些值。我安全通过;同时给 cookie 设置值。但我仍然收到“HTTPS 会话中的敏感 Cookie 没有‘安全’属性”漏洞。

document.cookie=`${name}=${val1};domain=${domainName};path=/;secure;`;
Run Code Online (Sandbox Code Playgroud)

javascript

5
推荐指数
1
解决办法
594
查看次数

将String格式的给定时间转换为Android中的秒数

假设时间以MM:SS(ex-02:30)或HH:MM:SS的字符串格式给出.我们可以将此时间转换为秒.

java android

4
推荐指数
1
解决办法
1万
查看次数

Docker 构建错误:命令“/bin/sh -c apt-get install –y apache2”返回非零代码:100

我正在尝试构建一个 Dockerfile

\n\n
FROM ubuntu \nRUN apt-get update \nRUN apt-get install \xe2\x80\x93y apache2 \nRUN apt-get install \xe2\x80\x93y apache2-utils \nRUN apt-get clean \nEXPOSE 80\nCMD [\xe2\x80\x9capache2ctl\xe2\x80\x9d, \xe2\x80\x9c-D\xe2\x80\x9d, \xe2\x80\x9cFOREGROUND\xe2\x80\x9d]\n
Run Code Online (Sandbox Code Playgroud)\n\n

当我运行此命令时,docker build \xe2\x80\x93t=\xe2\x80\x9dmywebserver\xe2\x80\x9d .我在控制台中收到以下错误消息

\n\n
E: Unable to locate package \xe2\x80\x93y\nThe command '/bin/sh -c apt-get install \xe2\x80\x93y apache2' returned a non-zero code: 100\n
Run Code Online (Sandbox Code Playgroud)\n

docker dockerfile

4
推荐指数
1
解决办法
1万
查看次数

在android中动态替换另一个视图的视图?

我已经在我的xml布局文件中添加了自定义视图,即FancyCoverFlow.我想以编程方式在同一位置用视频视图替换此视图.意味着不应该更改其他视图位置.应该在布局文件中显示它们.但只有我的自定义视图应替换为具有与FancyCoverFlow相同的位置坐标的视频视图.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/layout"
xmlns:fcf="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bga"

android:orientation="vertical" >

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Large Text"
    android:textColor="#fff"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Medium Text"
    android:textColor="#fff"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
    android:id="@+id/textView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Medium Text"
    android:textColor="#fff"
    android:textAppearance="?android:attr/textAppearanceMedium" />      

<imageslideractivty.FancyCoverFlow
    android:id="@+id/fancyCoverFlow"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:layout_marginTop="10dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"        
    fcf:maxRotation="45"
    fcf:unselectedAlpha="0.3"
    fcf:unselectedSaturation="0.0"
    fcf:unselectedScale="0.4"
    fcf:scaleDownGravity="0.5"/>
 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    >

 <SeekBar
    android:id="@+id/slider"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:layout_centerHorizontal="true"
    android:progressDrawable="@null"
    android:thumb="@drawable/middle"
    android:layout_marginBottom="20dp" />
</LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android android-custom-view android-videoview

-1
推荐指数
2
解决办法
3664
查看次数