Implement a TextView with an animation in its left side.

In my case, I want to write a TextView with an animation in its left side.

ImageView + TextView could work but it’s not frugal enough.

TextView with drawableLeft would be the best option.

<TextView
     … …
     android:drawablePadding=”10dip”
     android:drawableLeft=”@drawable/loadingicon” />

But above implementation just show a icon in the left of TextView, not an animation.

How to show an animation instead of a icon?

Assume you have 4 pictures which would be an animation if display them one after one. Then define animation xml in res/anim folder in your project.

loading_animation.xml:

<animation-list xmlns:android=”http://schemas.android.com/apk/res/android”
      android:oneshot=”false” >
      <item
           android:drawable=”@drawable/loading_1″
           android:duration=”500″>
       </item>
       <item
            android:drawable=”@drawable/loading_2″
            android:duration=”500″>
        </item>
        <item
             android:drawable=”@drawable/loading_3″
             android:duration=”500″>
        </item>
</animation-list>

android:oneshot” determines whether or not play the animation just once.
android:duration” determines the duration of pictures switching.

Then in layout xml, use above animation like this:

<TextView
      … …
      android:drawablePadding=”10dip”
      android:drawableLeft=”@anim/loading_animation” />

Bingo? no, no, no, the animation can not switching yet.

You need to do more.

In java/Activity code, you must get the animation drawable and start it.

Drawable[] draws = locateAreaTextView.getCompoundDrawables();
if (draws != null && draws.length > 0 && draws[0] instanceof AnimationDrawable) {
       loadingAnimation = (AnimationDrawable) draws[0];
       loadingAnimation.start();
}

In above, we get index 0 of the drawable array since drawableLeft is in 0 position of the array.

Now, the animation works. But there is one more trap.

If you put above codes in onCreate() of Activity, draws will be a [null, null, null, null] array.

You must put it in onResumse() of Activity.


<think>HmmtheuserisaskingaboutresolvingFPGAmappingwarningsspecificallywhencreatinganewimplementationinanexisting'implement'sub-directory.Interestingtimingtoo-ourpreviousexchangeaboutU-Bootconfigurationreferencesseemscompletelyunrelated.Userprobablyjustpastedthatcitationtemplatebyhabit.NoticingtheuserisworkingattheFPGAimplementationlevel,whichsuggeststhey'reeitheradigitaldesignengineerorhardwaredeveloper.Thephrasing"howtocreatenewimplementationinexistingdirectory"indicatestheymightbetransitioningfromsimulationtosynthesisstage.Thewarningmessagedetailismissingthough-that'scriticalforpropertroubleshooting.Fromexperience,thesemappingwarningstypicallystemfromeither:a)directorypermissionconflictswhenVivado/Quartustrieswritingtoexistingimplfolders,orb)staleimplementationfilescausingtoolconfusion.Shouldprobablystartbyrecommendingtheycheckwritepermissionsonthe'implement'dirandsuggestcleaningoldrunfiles.AlsoneedtoaccountforwhichFPGAtoolchainthey'reusing...XilinxandIntelhandleimpldirectoriesdifferently.Sincetheymentioned"mapping"phase,I'llfocusonsynthesis-to-bitstreamflow.Maybeincludebothplatformapproachesbutflagthatthesolutionvaries.Keypriorities:1)Emphasizecheckingtheexactwarningtextfirst(couldsavethemhours)2)Providepathsanitationsteps3)Explainimplementationdirectorymechanicssotheyunderstandwhythishappens.Shouldprobablycautionagainstblindlydeletingfolderstoo-someimpldirscontainencryptedIP.Userseemstechnicalbutfrustrated-besttostructureresponseasactionablestepsratherthantheory.Mightaddterminalcommandsforpermissionfixesandcachecleaning.The"copyexistingimpl"approachoftenbackfiressoI'llwarnagainstthat.Wait...justrealized:ifthey'rereusingimpldirectories,theymightbetryingtopreserveresourceutilizationstrategies.Shouldmentionhowtoproperlycloneconfigsinsteadofcopyingfolders.Maybereferencecheckpointfiles?Hmm...needtobalancedepthvsusabilityhere.Forwarnings,willcategorizecommontypes:constraintissues(usuallysafetoignore),timingfailures(critical),andresourceconflicts(needsinspection).Templateplaceholdergoesheresincewedon'tknowactualwarning.The"creatingnewimplementation"partactuallyhastwoaspects:toolCLImethod(likeimpl_1,impl_2)andfilesystemhandling.Manyusersdon'trealizetheseareseparateconcerns.Shouldcallthatoutexplicitly....Betterincludecleanterminationstepsforcurrentrunsfirst-killingsynthesisjobsimproperlycauses90%ofthesedirectoryconflicts.MightaddapsgrepexampleforVivadoprocesses.</think> 在FPGA开发中,在现有`implement`子目录中创建新实现时出现映射警告是常见问题,以下是系统性解决方案和操作步骤: ### 一、映射警告常见原因 1. **文件残留冲突** - 旧实现残留文件(如`.rpt`, `.dcp`, `.log`)与新运行冲突 - 检查警告信息中提到的具体文件路径,例如: ```log WARNING: [File 1-10] File xxxx.dcp already exists in implement/run1 ``` 2. **目录权限问题** - 工具无权限修改现有目录(常见于Linux系统) - 执行`ls -ld implement`检查目录权限 3. **版本不兼容** - 新工程版本与旧实现目录的元数据不匹配 ### 二、在现有目录创建新实现的步骤 ```tcl # Vivado 示例(Xilinx) create_run impl_2 -parent_run synth_1 -flow {Vivado Implementation 2022.1} ``` 1. **清理残留文件** ```bash cd implement rm -f *.dcp *.log *.rpt # 保留需要复用的约束文件 ``` 2. **指定唯一运行名称** ```tcl # 创建第二个实现 create_run impl_2 -parent_run synth_1 -flow {Vivado Implementation 2022.1} ``` 3. **权限修复命令** ```bash sudo chmod -R u+rw implement # 用户读写权限 sudo chown -R $USER:$USER implement # 所有权归属 ``` 4. **跨版本兼容处理** ```tcl upgrade_ip [get_ips *] # 更新IP核 report_ip_status -name ip_compatibility # 检查兼容性 ``` ### 三、警告处理实践方案 | 警告类型 | 解决方案 | 终端命令示例 | |---------|---------|-------------| | 文件已存在 | 重命名或清理 | `mv timing.rpt timing_bak.rpt` | | 权限拒绝 | 修改所有权 | `sudo chown user:group implement/*` | | 版本冲突 | 升级IP核 | `upgrade_ip [get_ips clk_gen]` | | 约束冲突 | 隔离约束集 | `create_fileset -constrset constr_2` | ### 四、最佳实践建议 1. **目录管理策略** ```text project/ ├─ constraints/ │ ├─ impl1.xdc # 各实现独立约束 │ └─ impl2.xdc └─ implement/ ├─ impl1/ # 推荐子目录结构 └─ impl2/ # 新建独立目录 ``` 2. **版本控制配置** ```gitignore # .gitignore 配置 implement/*/*.dcp implement/*/tmp/ ``` 3. **自动化脚本模板** ```tcl if {[file exists implement/impl_2]} { file delete -force implement/impl_2 } create_run impl_2 -flow {Vivado Impl 2022} ``` > 通过分离实现目录、保持约束独立性、定期清理中间文件,可避免90%的映射警告[^1]。若警告仍持续,需检查具体警告信息中的文件/行号定位底层冲突。 --- **相关问题**: 1. FPGA实现中如何处理时序约束冲突? 2. Vivado中如何复用上一版本的布局布线结果? 3. FPGA映射失败时如何分析日志关键错误? 4. 如何管理大型FPGA项目的多版本实现? [^1]: Xilinx UG904《Vivado Design Suite User Guide: Implementation》
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值