2016-05-24 2 views
0

Я создал список Курс обмена валюты, используя таблицу с 6 рядами. Я хочу, чтобы 6 строк имели некоторую анимацию, как будто она бегала вверх и вниз автоматически в некоторый период времени, чтобы она могла сделать пользователя более привлекательным для пользователя.Сделать строку таблицы прокруткой вверх и вниз в некоторый период времени автоматически

, пожалуйста, дайте мне пример или если у вас есть идея сделать анимацию строки таблицы, которая станет более привлекательной для пользователя.

ответ

0

Переместить прокрученное положение вашего вида.

общественный недействительный scrollBy (целое х, Int у)

Параметры

х - количество пикселей для прокрутки по горизонтали

у - количество пикселей для прокрутки с помощью по вертикали

lv.scrollBy(100,100) //....like this 
+0

Можете ли вы дать больше пример ,,, я не так специализироваться о Java. Пожалуйста, помогите: –

+0

,,, как мой код выше, пожалуйста, помогите советом !!! спасибо –

0
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:weightSum="1"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="30dp" 
     android:layout_margin="0sp" 
     android:layout_weight="0.03" 
     android:background="@drawable/gradient"> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/logo" 
      android:layout_marginLeft="50dp" 
      android:layout_marginTop="5dp" 
      android:layout_marginBottom="5dp" /> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="35dp" 
      android:layout_marginTop="10dp" 
      android:text="GOLDEN ROYAL EXCHANGE" 
      android:textColor="#ba8707" 
      android:textStyle="bold" 
      android:textSize="16sp" 
      android:backgroundTintMode="multiply" 
      android:shadowColor="#030303" 
      android:phoneNumber="true" /> 

    </LinearLayout> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:layout_margin="1sp" 
     android:background="@drawable/lineback" 
     android:layout_weight="0.62"> 
     <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/myScrollview" 
      android:scrollbars="none"> 

     <TableLayout 
      android:id="@+id/table01" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <TableRow 
       android:background="#4042dba8" 
       android:id="@+id/khmerrow" 
       android:layout_height="fill_parent" 
       android:layout_width="fill_parent" 
       android:minHeight="145px" 
       android:layout_marginTop="3dp"> 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="3dp" 
        android:src="@drawable/khmerflages" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="-8dp" 
        android:text="Khmer Riel 柬币" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="20dp" 
        android:text="USD/KHR" 
        android:textColor="#000000" 
        android:textSize="12sp" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="30dp" 
        android:text="4,200" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
      </TableRow> 
      <TableRow android:background="#4042dba8" 
       android:layout_height="fill_parent" 
       android:layout_width="fill_parent" 
       android:minHeight="145px" 
       android:layout_marginTop="2.5sp"> 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="3dp" 
        android:src="@drawable/thaiflags" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="-12dp" 
        android:layout_gravity="center" 
        android:text="Thai Baht 泰铢" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="25dp" 
        android:text="USD/THB" 
        android:textColor="#000000" 
        android:textSize="12sp"/> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="30dp" 
        android:text="35" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
      </TableRow> 
      <TableRow android:background="#4042dba8" 
       android:layout_height="fill_parent" 
       android:layout_width="fill_parent" 
       android:minHeight="145px" 
       android:layout_marginTop="2.5sp"> 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="3dp" 
        android:src="@drawable/chinaflags" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="-3dp" 
        android:layout_gravity="center" 
        android:text="China RMB 人民币" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="18dp" 
        android:text="USD/RMB" 
        android:textColor="#000000" 
        android:textSize="12sp"/> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="30dp" 
        android:text="6.7" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
      </TableRow> 
      <TableRow android:background="#4042dba8" 
       android:layout_height="fill_parent" 
       android:layout_width="fill_parent" 
       android:minHeight="145px" 
       android:layout_marginTop="2.5sp"> 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="3dp" 
        android:src="@drawable/hongkongflags" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="9dp" 
        android:layout_gravity="center" 
        android:text="HongKong Dollar 港币" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="8dp" 
        android:text="USD/HKD" 
        android:textColor="#000000" 
        android:textSize="12sp"/> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="30dp" 
        android:text="8.7" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
      </TableRow> 
      <TableRow android:background="#4042dba8" 
       android:layout_height="fill_parent" 
       android:layout_width="fill_parent" 
       android:minHeight="145px" 
       android:layout_marginTop="2.5sp"> 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="3dp" 
        android:src="@drawable/malaysiaflags" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="3dp" 
        android:layout_gravity="center" 
        android:text="Malaysia MYR 马币" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="15dp" 
        android:text="USD/MYR" 
        android:textColor="#000000" 
        android:textSize="12sp"/> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="30dp" 
        android:text="6.6" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
      </TableRow> 
      <TableRow android:background="#4042dba8" 
       android:layout_height="fill_parent" 
       android:layout_width="fill_parent" 
       android:minHeight="145px" 
       android:layout_marginTop="2.5sp"> 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="3dp" 
        android:src="@drawable/singaporeflags" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="3dp" 
        android:layout_gravity="center" 
        android:text="Singapore SGD 新币" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="15dp" 
        android:text="USD/SGD" 
        android:textColor="#000000" 
        android:textSize="12sp"/> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="30dp" 
        android:text="1.6" 
        android:textColor="#000000" 
        android:textSize="13sp" 
        android:textStyle="bold" /> 
      </TableRow> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="33dp" 
       android:layout_marginTop="2.5sp" 
       android:textColor="#000000" 
       android:id="@+id/date" /> 


     </TableLayout> 
     </ScrollView> 

    </LinearLayout> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:layout_margin="1sp" 
     android:background="#dee6d461" 
     android:layout_weight="0.36"> 

     <ViewFlipper 
      android:id="@+id/bckgrndViewFlipper1" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 
      <ImageView 
       android:id="@+id/bckgrndImageView8" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:scaleType="centerCrop" 
       android:src="@drawable/exchange1" /> 
      <ImageView 
       android:id="@+id/bckgrndImageView7" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:scaleType="centerCrop" 
       android:src="@drawable/exchange2" /> 
      <ImageView 
       android:id="@+id/bckgrndImageView6" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:scaleType="centerCrop" 
       android:src="@drawable/exchange3" /> 
      <ImageView 
       android:id="@+id/bckgrndImageView5" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:scaleType="centerCrop" 
       android:src="@drawable/exchange4" /> 
      <ImageView 
       android:id="@+id/bckgrndImageView4" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:scaleType="centerCrop" 
       android:src="@drawable/exchange5" /> 
      <ImageView 
       android:id="@+id/bckgrndImageView3" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:scaleType="centerCrop" 
       android:src="@drawable/exchange6" /> 
     </ViewFlipper> 

    </LinearLayout> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="25dp" 
     android:background="@drawable/gradient"> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/trading" 
      android:ellipsize="marquee" 
      android:marqueeRepeatLimit="marquee_forever" 
      android:scrollHorizontally="true" 
      android:singleLine="true" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:text="Trading Hours .................`enter code here`" 
      android:textSize="13sp" 
      android:textColor="#ba8707"/> 
    </LinearLayout> 


</LinearLayout> 

0

общественного класса MainActivity расширяет AppCompatActivity {

Animation fade_in, fade_out, rowanimation; 
ViewFlipper viewFlipper; 
ScrollView myView; 
TextView date; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    viewFlipper = (ViewFlipper) this.findViewById(R.id.bckgrndViewFlipper1); 
    fade_in = AnimationUtils.loadAnimation(this, 
      android.R.anim.fade_in); 
    fade_out = AnimationUtils.loadAnimation(this, 
      android.R.anim.fade_out); 
    viewFlipper.setInAnimation(fade_in); 
    viewFlipper.setOutAnimation(fade_out); 
    viewFlipper.setAutoStart(true); 
    viewFlipper.setFlipInterval(5000); 
    viewFlipper.startFlipping(); 


} 

}