我想要一个类似于此的gridview

每个奇数编号的行将有两个大尺寸的图像,偶数编号的行将有四个较小的图像.我怎样才能实现这一点?
我正在开发一个android应用程序.我将有一个listview,并且我设置了一个上下文菜单,当listview项目被长按时出现.如何从列表视图项目中选择项目(比如listview textview中的文本)选择了一个来自contextmenu的动作,我可以处理它吗?这是一些代码:
protected void onCreate(Bundle savedInstanceState) {
-------
lv1 = (ListView) findViewById(R.id.listings);
registerForContextMenu(lv1);
lv1.setOnItemClickListener(this);
}
Run Code Online (Sandbox Code Playgroud)
和onCreateContextMenu:
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.context_menu, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
.getMenuInfo();
switch (item.getItemId()) {
case R.id.watch:
String name = "";
return true;
case R.id.buy:
return true;
default:
return super.onContextItemSelected(item);
}
}
Run Code Online (Sandbox Code Playgroud)
我想从列表项中的textview获取文本.我如何实现这一目标?
我正在开发一款Android应用.我想使用其IP地址确定设备的位置.我从哪里开始?Google API上的链接不够完善.谢谢.
我有一个实现自定义对话框的android活动.应用程序运行正常,但对话框太小,我想显示一个更大的对话框.我怎么能实现这个?这是我的布局xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/view_more_borders">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_marginTop="4dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/share_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Company Name:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/nice_blue"
android:typeface="sans" />
<TextView
android:id="@+id/textViewCompanyName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.80"
android:text=" "
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginTop="4dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/textView5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price per share:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/nice_blue" />
<TextView
android:id="@+id/textViewprice_pershare"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:layout_alignBaseline="@+id/Yesterday"
android:layout_alignBottom="@+id/Yesterday"
android:layout_marginLeft="38dp"
android:fontFamily="sans-serif"
android:layout_toRightOf="@+id/company"
android:text=" "
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" …Run Code Online (Sandbox Code Playgroud) 我有三个活动
MessagesAttachPhotoActivityMessageGalleryFolderSelectorActivityImagePickerActivityMessagesAttachPhotoActivity呼吁MessageGalleryFolderSelectorActivity有startActivityForResult().
MessageGalleryFolderSelectorActivity 活动显示手机上的照片文件夹,一个选择文件夹.
ImagePickerActivity然后调用setActivityForResult().一旦选择了图像ImagePickerActivity,它就会被传递回MessagesAttachPhotoActivityvia MessageGalleryFolderSelectorActivity.
当我第一次运行应用程序时,一切正常.但是,如果我之后尝试再次选择图像,MessageGalleryFolderSelectorActivity则不会在之后关闭setResult().
我已经打过电话finish(),this.finish(),((Activity)getApplicationContext()).finish(),并super.onBackPressed()没有成功.
为什么活动不会在连续运行中关闭?
Intent intent;
Bundle arguments = new Bundle();
Bundle bundle;
intent = new Intent(this, MessageGalleryFolderSelectorActivity.class);
bundle = new Bundle();
bundle.putInt(Constants.INTENT_EXTRA_LIMIT, Constants.IMAGES_SELECT_LIMIT);
bundle.putInt("Request", MessageThread.MessageType.IMAGE);
intent.putExtras(bundle);
startActivityForResult(intent, MessageThread.MessageType.IMAGE);
Run Code Online (Sandbox Code Playgroud)
imagesIntent.putExtra(ImagePickerActivity.INTENT_EXTRA_MODE,
ImagePickerActivity.MODE_MULTIPLE);
imagesIntent.putExtra(ImagePickerActivity.INTENT_EXTRA_LIMIT, 10);
imagesIntent.putExtra(ImagePickerActivity.INTENT_EXTRA_SHOW_CAMERA, false);
imagesIntent.putExtra(ImagePickerActivity.INTENT_EXTRA_ALBUM,album);
//imagesIntent.putExtra(ImagePickerActivity.INTENT_EXTRA_SELECTED_IMAGES, images);
startActivityForResult(imagesIntent, MessageThread.MessageType.IMAGE);
Run Code Online (Sandbox Code Playgroud)
Intent data = …Run Code Online (Sandbox Code Playgroud) android android-intent android-activity startactivityforresult
在开发Android和Java应用程序时,我一直在使用PHP脚本与在线MySQL数据库进行交互,但是现在我想迁移到Python。
如何在网络服务器上运行Python脚本?根据我使用PHP的经验,我一直将文件保存/var/www在Linux环境中的文件夹下。然后,我稍后使用路径的URL调用文件。我在哪里保存Python脚本?
我试图将android工作室项目导入新机器.导入正常,项目的目录正确显示.但是,当我尝试构建或清理项目时,android studio引发了以下错误
Gradle 'ngoma' project refresh failed
Error:Unexpected lock protocol found in lock file. Expected 3, found 0.
Run Code Online (Sandbox Code Playgroud)
我尝试关闭并重新打开项目,更改包含项目的文件夹的权限,但没有任何变化.我怎样才能解决这个错误?
我正在开发一个需要用户登录的应用程序.登录通过网址正常工作.但是,当我添加AsyncTask来添加进度对话框时,应用程序不会改变intent.我已经尝试了所有可能的方法,我都知道是徒劳的.以下是代码:
package com.epolicing;
import java.util.ArrayList;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class LoginActivity extends Activity implements OnClickListener{
Button loginButton;
EditText usernme,passwrd;
TextView error;
String username,password;
static final int Dialog_logging_in=1;
boolean userverified=false;
// Session Manager Class
SessionManager session;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
session = new SessionManager(getApplicationContext());
loginButton = (Button) findViewById(R.id.loginButton);
usernme = (EditText) …Run Code Online (Sandbox Code Playgroud) 我有一个PHP脚本,有三个查询,每个查询返回一组结果.
现在我想将三个查询的结果合并到一个JSON数组中.
谁知道如何实现这一目标?
查询无法加入.
谢谢.
android ×7
contextmenu ×1
customdialog ×1
geolocation ×1
gradle ×1
gridview ×1
json ×1
listview ×1
mysql ×1
php ×1
python ×1
toolbar ×1