我正在使用Chris Banes 的PhotoView类能够放大图像并看到它,但我想这样做,以便当我改变方向时,照片仍将在更改后放大.
我理解如何执行此操作的基础知识,当检测到方向更改时,将调用onSaveInstanceState,因此我尝试将实例保存在那里,然后在调用onCreate时将其放回到PhotoView中.
public class MainActivity extends ActionBarActivity
{
PhotoView mPhotoView;
@Override
protected void onCreate( Bundle aSavedInstanceState )
{
super.onCreate( aSavedInstanceState );
mPhotoView = new PhotoView(this);
mPhotoView.setMaximumScale( 12 );
setContentView( mPhotoView );
mPhotoView.setImageResource( R.drawable.vm_app_icon);
if (aSavedInstanceState != null)
{
RectF theRect = aSavedInstanceState.getParcelable( "Rect" );
if ( theRect != null)
{
Matrix theMatrix = new Matrix();
theMatrix.setScale( theRect.bottom, theRect.left, theRect.right, theRect.top );
mPhotoView.setDisplayMatrix( theMatrix );
}
}
}
@Override
protected void onSaveInstanceState( final Bundle outState )
{ …Run Code Online (Sandbox Code Playgroud) 所以我一直在研究关于宏的C编程并使用它们,但在我的工作中我经常使用PL/SQL而且我想知道是否有某种方法可以在PL/SQL中执行相同类型的操作.现在我让它调用一个具有3个不同值的函数,然后返回一个值,但函数非常简单,我想我可以从原始存储过程内部完成.在C中,宏是一行(或多行)代码,它们在编译时完全被调用替换,但它比反复调用函数更有效.
C的例子:
#define query(fieldValue, Attribute, Table) (select fieldValue from Table where record = Attribute)
Run Code Online (Sandbox Code Playgroud)
当在代码体中调用时,查询(值,值,值)将完全被select语句替换.
只是一个粗略的例子,它可能出现在C中,因为我真的不确定它在PL/SQL中的表现.
这在SQL中可行吗?它必须是2-3行代码,就是这样.
非常感谢,SMKS
我正在使用Android Studios 1.5
我试图做一些非常简单的事情:在我的项目中添加一个大图像,我将用作MainActivity的背景.当我右键单击res-> Add-> Image Asset并选择"Action Bar and Tab Icons"并将其指向我的图像时,它会呈现完全空白的矩形,如下所示:
我究竟做错了什么?我已经阅读了几个不同的页面,没有其他人遇到过这个问题.