我正在通过Web服务解析数据.我希望水平翻转而不是垂直翻转.这是一个使用ViewFlipper的教程,但它适用于静态数据.
这是我们的代码,我们需要在两个活动之间翻转:
Splash.java
public class Splash extends Activity{
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startActivity(new Intent(Splash.this, MainMenu.class));
Splash.this.finish();
}
}
Run Code Online (Sandbox Code Playgroud)
Splash.xml
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/splash">
</AbsoluteLayout>
Run Code Online (Sandbox Code Playgroud)
Menu.java
public class Menu extends Activity{
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
}
}
Run Code Online (Sandbox Code Playgroud)
menu.xml文件
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/menu">
</AbsoluteLayout>
Run Code Online (Sandbox Code Playgroud) 我有一个方法返回CharSequence []并且不为空(用日志检查)但不显示在对话框中.我是否必须初始化boolean []数组; 我没有看到任何错误,所以也许有一些我想念的东西.我的代码是:
dbManager.open();
final CharSequence[] usrCats = dbManager.getUserCreatedCategories();
dbManager.close();
final boolean[] selections = new boolean[usrCats.length];
alert = b.setTitle(R.string.remove_category)
.setMessage(R.string.delete_categories_msg)
.setMultiChoiceItems(usrCats, selections, new DialogInterface.OnMultiChoiceClickListener(){
public void onClick(DialogInterface dialog, int which, boolean isChecked){
}
})
.setPositiveButton("Create", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int which){
}
}).create();
}
Run Code Online (Sandbox Code Playgroud) 我正在使用相机拍照并希望存储在数据库中(SQLite).存储的照片必须显示在另一个活动中,列表视图就像这个列表视图图像 和这个 iam使用此代码拍照但如何将照片存储在数据库中并显示在另一个活动任何想法请帮助.....
谢谢....
这是拍照的代码
public class PhotoActivity extends Activity {
private static final int CAMERA_REQUEST = 1888;
public ImageView imageView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.photoactivity);
this.imageView = (ImageView)this.findViewById(R.id.imageView1);
Button B = (Button) this.findViewById(R.id.camera);
B.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(photo);
}
}
}
Run Code Online (Sandbox Code Playgroud) 面对这个错误
Multiple annotations found at this line:
- error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false"
attribute?
- error: Unexpected end tag string
Run Code Online (Sandbox Code Playgroud)
这是我的代码
<resources>
<string name="app_name">SpeedTest</string>
<string name="network_edge">Network : EDGE</string>
<string name="network_3g">Network : 3G</string>
<string name="network_detecting">Network : Detecting </string>
<string name="update_speed">%s kbit/sec</string>
<string name="update_downloaded">Downloaded %s of %s</string>
<string name="update_connectionspeed">Connection time %s ms</string>
<string name="update_downloaded_complete">Downloaded %s @ %s kbit/sec</string>
</resources>
Run Code Online (Sandbox Code Playgroud)
面对这条线的错误
<string name="update_downloaded">Downloaded %s of %s</string>
Run Code Online (Sandbox Code Playgroud) 我使用了一个可扩展的列表视图,组列指示器显示在列表的右侧,在此我有标题名称是单行我的输出像这样
在上图中我的指标看起来不错.在下面的图像我的指标看起来不好它扩大,为什么会发生这种情况

这是我的代码
mExpandableList = (ExpandableListView)findViewById(R.id.expandable_list);
mExpandableList.setIndicatorBounds(width - GetPixelFromDips(40), width - GetPixelFromDips(10));
Run Code Online (Sandbox Code Playgroud)
xml是
<ExpandableListView
android:id="@+id/expandable_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:groupIndicator="@drawable/group_indicator" />
Run Code Online (Sandbox Code Playgroud)
group_indicator.xml是
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/arrow_down" android:state_expanded="true"/>
<item android:drawable="@drawable/arrow_up"/>
</selector>
Run Code Online (Sandbox Code Playgroud)
任何人都有想法帮助这一个........
我想Picasa/Instagram在我的Android应用中显示图片.如何获取picasa/Instagram相册图像并显示我的应用程序我不是任何例子.Picasa/Instagram如何获取图像.
有没有人找到一些好的图书馆/例子?
我正在做一个与根据给定的生日日期输入获得一个人的年龄相关的应用程序.因为我从下面的代码获得从该日期到当前日期的总天数.
String strThatDay = "1991/05/10";
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
Date d = null;
try {
try {
d = formatter.parse(strThatDay);
Log.i(TAG, "" +d);
} catch (java.text.ParseException e) {
e.printStackTrace();
}
} catch (ParseException e) {
e.printStackTrace();
}
Calendar thatDay = Calendar.getInstance();
thatDay.setTime(d); //rest is the same....
Calendar today = Calendar.getInstance();
long diff = today.getTimeInMillis() - thatDay.getTimeInMillis();
long days = diff / (24 * 60 * 60 * 1000);
Run Code Online (Sandbox Code Playgroud)
从这段代码我得到总天数.所以我的要求是将总天数转换为年,月和日......请帮助....
在我的应用程序在地图视图上自由绘制绘画,但搜索很多信息最终从mapview上的矩形形状绘制,但我想取代矩形绘制像Zigzag一样的自由手如何更改我的代码任何帮助请...
MapOverlay.java
public class MapOverlay extends Overlay {
private float x1,y1,x2,y2;
private GeoPoint p1=null,p2=null;
private MapExampleActivity mv = null;
private Paint paint = new Paint();
private Path path = new Path();
private boolean isUp = false;
//constructor receiving the initial point
public MapOverlay(MapExampleActivity mapV,float x,float y){
paint.setStrokeWidth(2.0f);
x1 = x;
y1 = y;
mv = mapV;
p1 = mapV.getMapView().getProjection().fromPixels((int)x1,(int)y1);
}
//override draw method to add our custom drawings
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { …Run Code Online (Sandbox Code Playgroud) 我使用Holo dark作为我的应用程序的主题.但是,有一部分我希望使用EditText,holo light因为这部分背景很轻.我试过这样做themes.当我为按钮做了类似的事情时(我们想要使用姜饼样式按钮):
<style
name="Theme.Banks" parent="Theme.Sherlock.ForceOverflow">
<item name="android:buttonStyle">@android:style/Widget.Button</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我尝试用android:editTextStyle做同样的事情,但它不会影响drawable.这是由android:editTextBackground属性处理的.查看代码,我不能只是覆盖它并将其指向light主题,因为它引用了一个私有的drawable:
这来自SDK中的themes.xml:
<item name="editTextBackground">@android:drawable/edit_text_holo_dark</item>
Run Code Online (Sandbox Code Playgroud)
所以我的问题是如何做到这一点?
另一个用例可能是希望使用姜饼的EditText.
有任何想法吗?
嗨所有应用程序实现的视频捕获持续时间,我设置持续时间是10秒.
但它不适用于Nexus设备,除了Nexus之外它适用于所有设备可以任何人都知道这是什么问题.
这是守则.
final int durationLimit = 10;
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, durationLimit);
startActivityForResult(intent, CAMERA_CODE);
Run Code Online (Sandbox Code Playgroud)