我的应用程序的网格视图有3行3列.无论设备的屏幕尺寸如何,我希望它能够填满屏幕.
我尝试获取窗口大小并相应地设置layoutparams.但这并没有给出完美的对齐方式,因为它与linearlayout中的权重一起使用.
那么我们可以对gridview使用权重,还是可以使用任何其他android属性.非常感谢您的时间和回应.
<GridView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/text1view"
android:background="@drawable/home_bg"
android:gravity="center"
android:horizontalSpacing="10dip"
android:numColumns="3"
android:stretchMode="columnWidth" />
Run Code Online (Sandbox Code Playgroud)
每个网格项目是
<?xml version="1.0" encoding="utf-8"?>
Run Code Online (Sandbox Code Playgroud)
<ImageView
android:id="@+id/grid_item_image"
android:layout_width="wrap_content"
android:layout_height="75dip"
android:layout_margin="0dip"
android:padding="0dip" >
</ImageView>
<TextView
android:id="@+id/grid_item_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@+id/grid_item_image"
android:gravity="center_horizontal"
android:padding="0dip"
android:textColor="#000000"
android:textSize="10sp" >
</TextView>
Run Code Online (Sandbox Code Playgroud)
适配器的代码:
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.griditems, null);
holder = new ViewHolder();
holder.text1 = (TextView) convertView
.findViewById(R.id.grid_item_text);
holder.image = (ImageView) …Run Code Online (Sandbox Code Playgroud) Run Code Online (Sandbox Code Playgroud)public static boolean verify(PublicKey publicKey, String signedData, String signature) { Log.i(TAG, "signature: " + signature); Signature sig; try { sig = Signature.getInstance(SIGNATURE_ALGORITHM); sig.initVerify(publicKey); sig.update(signedData.getBytes()); if (!sig.verify(Base64.decode(signature))) { Log.e(TAG, "Signature verification failed."); return false; } return true; } catch (NoSuchAlgorithmException e) { Log.e(TAG, "NoSuchAlgorithmException."); } catch (InvalidKeyException e) { Log.e(TAG, "Invalid key specification."); } catch (SignatureException e) { Log.e(TAG, "Signature exception."); } catch (Base64DecoderException e) { Log.e(TAG, "Base64DecoderException.", e); } return false; }
我推出了我的Google Play测试帐户的公钥,但此方法返回false值.我使用android SDK的market_billing项目进行InApp Billing.除Inlink计费中使用的公钥外,还有其他任何值.
logcat output-
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)09-03 14:10:43.439: …
我已经建立了smoothScrollToPosition一个listview和它的作品完美!但是......我宁愿将位置listview放在屏幕的顶部,而不是仅仅放在屏幕上(如果需要向下滚动,则大多放在底部).任何想法我怎么能做到这一点?