我正在使用 android 支持设计BottomNavigationView进行底部标签导航。
<android.support.design.widget.BottomNavigationView
android:id="@+id/main_nav"
android:layout_width="match_parent"
android:layout_height="56dp"
app:labelVisibilityMode="unlabeled"
app:itemIconSize="40dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
app:itemBackground="@color/blue_active"
app:menu="@menu/nav_items">
</android.support.design.widget.BottomNavigationView>
Run Code Online (Sandbox Code Playgroud)
我想做的是:
ObjectAnimator 按下时以编程方式动画选项卡(菜单)图标
这是菜单:
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_home"
android:icon="@drawable/ic_home"
android:title="@string/nav_home" />
<item
android:id="@+id/nav_games"
android:icon="@drawable/games"
android:title="@string/nav_games" />
<item
android:id="@+id/nav_profile"
android:icon="@drawable/profile"
android:title="@string/nav_profile" />
</menu>
Run Code Online (Sandbox Code Playgroud)
代码:
mMainNav.setOnNavigationItemSelectedListener { item ->
when (item.itemId) {
R.id.nav_home -> {
//item.icon is drawable
var myAnimation = ObjectAnimator.ofFloat(item.icon,"rotation",0f,360f)
myAnimation.duration = 500
myAnimation.start() //nothing happens
setFragment(HomeFragment)
true
}
Run Code Online (Sandbox Code Playgroud)
有了这个,没有任何动画。
怎么了 ?我应该使用另一种方式来制作动画还是我只是应用错误?
我尝试使用 icon drawable 为 imageview 设置动画,然后将其设置为 items actionview 但这也不起作用。(发生了一些反应,但产生了一些无关的奇怪行为) …
我正在使用IntelliJ IDEA开发应用程序的客户端。为了调试,我需要运行多个客户端。
我猜用IntelliJ IDEA无法在不同的窗口中运行相同的项目。那么如何运行多个客户端进行调试?
我在 android 项目中使用 libGDX 作为片段所有与 kotlin 和它的工作正常。
我想要做的是从项目的android部分(MainActivity)调用项目的libgdx部分的方法。
例如,如果用户按下由 android 部分制作的按钮,游戏中的对象将移动。
首先这是项目结构:
主要活动:
package com.krytasoft.androidwithlibgdx
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
//import android.support.v4.app.Fragment throws unresolved error.without this compiles fine and works but shows type mismatch error.
import com.badlogic.gdx.backends.android.AndroidFragmentApplication
import com.krytasoft.gdxandroid.AndroidGameFragment
class MainActivity : AppCompatActivity(), AndroidFragmentApplication.Callbacks {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val libgdxGameFragment:AndroidGameFragment = AndroidGameFragment()
val button = findViewById<Button>(R.id.openFlexBoxTestButton)
val moveRightButton = findViewById<Button>(R.id.moveRightButton)
//never mind if this supportFragmentManager... shows type mismatch error.Its working. this line …Run Code Online (Sandbox Code Playgroud)