这是我的布局文件:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="#000"
tools:context=".CproductDetails" >
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_bg"
>
<ImageView
android:id="@+id/product_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_tweet_placeholder_photo_dark_error"
android:scaleType="center" />
<TextView
android:id="@+id/product_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textColor="#95ab56"
android:textSize="20sp"
android:layout_marginTop="7dip" />
<TextView
android:id="@+id/product_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="20sp"
android:textColor="#efeeea" />
<TextView
android:id="@+id/product_commerce"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="20sp" />
<TextView
android:id="@+id/product_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="15sp"
android:layout_marginTop="10dip"
android:layout_marginBottom="10dip" />
<TextView
android:id="@+id/product_township"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="15sp"
android:visibility="gone"
android:layout_marginBottom="10dip"
android:drawableLeft="@drawable/location_place"
android:drawablePadding="7dip" />
<TextView
android:id="@+id/product_website"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:autoLink="web"
android:textSize="15sp"
android:drawableLeft="@drawable/location_web_site"
android:drawablePadding="7dip" …Run Code Online (Sandbox Code Playgroud) 启动我的应用时出现这些日志错误:
> 05-20 01:48:35.312: E/AndroidRuntime(23032): FATAL EXCEPTION: main
05-20 01:48:35.312: E/AndroidRuntime(23032): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tomsyweb.suna/com.tomsyweb.suna.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class com.origamilabs.library.views.StaggeredGridView
05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
05-20 01:48:35.312: E/AndroidRuntime(23032): at android.os.Handler.dispatchMessage(Handler.java:99)
05-20 01:48:35.312: E/AndroidRuntime(23032): at android.os.Looper.loop(Looper.java:130)
05-20 01:48:35.312: E/AndroidRuntime(23032): at android.app.ActivityThread.main(ActivityThread.java:3687)
05-20 01:48:35.312: E/AndroidRuntime(23032): at java.lang.reflect.Method.invokeNative(Native Method)
05-20 01:48:35.312: E/AndroidRuntime(23032): at java.lang.reflect.Method.invoke(Method.java:507)
05-20 01:48:35.312: E/AndroidRuntime(23032): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
05-20 01:48:35.312: …Run Code Online (Sandbox Code Playgroud) 我知道这里有很多关于这方面的话题.我也多次阅读文档,但我找不到将数据从活动传递到片段的最佳方法.
我希望能够使用带选项卡的滑动视图在两个不同的布局(列表和地图)中显示我的可搜索活动的结果.我必须将2个数据传递给片段:"currentLocation"是当前用户位置,"result"是对象列表.
我已经省略了代码的某些部分,以使其更容易理解.
SearchableActivity.java
public class SearchableActivity extends ActionBarActivity implements TabListener {
List<PlaceModel> result = new ArrayList<PlaceModel>();
private SearchView mSearchView;
private String currentLocation;
AppSectionsPagerAdapter mAppSectionsPagerAdapter;
ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_searchable);
final ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mAppSectionsPagerAdapter);
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
actionBar.setSelectedNavigationItem(position);
}
});
actionBar.addTab(actionBar.newTab().setText("List").setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("Map").setTabListener(this));
// get currentLocation here
handleIntent(getIntent());
}
@Override
protected void onNewIntent(Intent intent) {
handleIntent(intent); …Run Code Online (Sandbox Code Playgroud) android android-layout android-fragments android-view android-tabs
当我启动我的应用程序时,我收到此错误UnicodeDecodeError:'utf8'编解码器无法解码位置2566中的字节0xe9:无效的连续字节.我在我的HTML文件中使用UTF8
<meta charset="utf-8" />
Run Code Online (Sandbox Code Playgroud)
在我的Python文件中
# -*- coding: utf-8 -*-
self.response.headers['Content-Type'] = 'text/html; charset=UTF-8'
Run Code Online (Sandbox Code Playgroud)
我使用encode()函数在Web上看到了一些解决方案,但我不想在Python文件中插入文本,而是在HTML文件中插入文本.
我搜索了一个很棒的 Python 库日期,比如Moment.js。你知道一些吗?
我特别想要一个可以进行这样转换的库:09/25/2012 00:00 - 09/25/2012 13:00到09/25/2012 00:00 - 13:00。
我有两个模型:会员和活动.会员可以参加许多活动,在一个活动中,有很多参与者.我想是这样的:
class Members(ndb.model):
event = ndb.KeyProperty(repeated=True)
class Events(ndb.model):
member = ndb.KeyProperty(repeated=True)
Run Code Online (Sandbox Code Playgroud)
做多对多关系的最佳方式是什么?
我知道如何为Joomla 1.6创建一个模块.但我听说可以在同一个XML安装文件中添加一组Joomla 1.5参数和一组Joomla 1.6参数,以使一个软件包只与1.6和1.5兼容.我试过这个技巧,但XML文件无效.
你能给出一个与Joomla 1.5和Joomla 1.6兼容的XML文件的例子吗?
我搜索了一个很好的Android图像识别API /库.我发现了一些,但它们不适合我,因为我们必须将图像放在他们的服务器上.我想要一个允许您在自己的服务器上搜索的内容.
我的数据库中有一个产品列表(名称+图像).我希望允许用户使用他的手机拍照并获取相关产品图片.
编辑
搜索之后,我还没有找到一个完全符合我需求的库(在你自己的服务器上搜索).但我发现一个与其他人相比是完美的(用json将元数据附加到图像上,为项目上传多个图像):Kooaba.不幸的是,Kooaba没有Android库.如果你能推荐像Kooaba这样的东西,那就太棒了.
我正在使用
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setSupportProgressBarIndeterminateVisibility(true);
setSupportProgressBarIndeterminateVisibility(false);
Run Code Online (Sandbox Code Playgroud)
启用/禁用不确定的进度条.使用ActionBarSherlock,它适用于所有设备,但在与ActionBarCompat一起使用时,它仅适用于2.3以上的Android版本.
我想过使用WindowCompat而不是Window,但是WindowCompat没有使用FEATURE_INDETERMINATE_PROGRESS标志.