这是main_alllatestnews.xml的一部分
<LinearLayout
android:id="@+id/layout_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/layout_menu"
android:layout_below="@id/layout_title"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这里充满了main_alllatestnewslist.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_temp"
android:layout_width="fill_parent"
android:layout_height="100px"
android:background="@drawable/background_news_list" >
<ImageView
android:id="@+id/image_alllatestnewstitle"
android:layout_width="134px"
android:layout_height="80px"
android:layout_marginBottom="5px"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_marginTop="5px"
android:scaleType="centerCrop" />
<LinearLayout
android:id="@+id/test"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/text_particularlatestnewstitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="25px" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25px" >
<TextView
android:id="@+id/text_newsdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#999999"
android:textSize="15px" />
<TextView
android:id="@+id/text_newscategorytitle"
android:layout_width="50px"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:gravity="right"
android:textColor="#ff0000"
android:textSize="15px" />
</RelativeLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是main_alllatestnews.java的一部分
LayoutInflater liInflater = (LayoutInflater) this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
linear.addView(liInflater
.inflate(R.layout.main_alllatestnewslist, …Run Code Online (Sandbox Code Playgroud) <rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/your_drawable"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" />
Run Code Online (Sandbox Code Playgroud)
我想以编程方式旋转drawable.
我该怎么办?
这是我的回调
private class RotateListener implements RotateGestureDetector.OnRotateGestureListener{
@Override
public boolean onRotate(MotionEvent event1, MotionEvent event2,
double deltaAngle) {
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
在deltaangle不大于0.1,我不知道什么是提取价值.
我有一个线性布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_menu"
android:layout_width="fill_parent"
android:layout_height="70px"
android:layout_alignParentBottom="true"
android:background="@drawable/footer_bar"
android:gravity="center" >
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
当我设定条件
if (constant.getscreenresolution() >= 800) {
//i want to make it height * 2
}
Run Code Online (Sandbox Code Playgroud)
那么如何设定layout params?
我有一个gridview
<GridView
android:id="@+id/gridview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="60px"
android:layout_marginRight="60px"
android:background="#343434"
android:listSelector="#00343434"
android:numColumns="2"
android:verticalSpacing="25px" >
</GridView>
Run Code Online (Sandbox Code Playgroud)
当我点击时,一个灰色的颜色框将指示被点击的项目.
我想在点击项目时删除灰色框效果.
请给出一些建议,谢谢.
这是活动
private View footer;
private Button btnmore;
linear = (LinearLayout) findViewById(R.id.layout_content);
linear.setVisibility(View.VISIBLE);
LayoutInflater liInflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
linear.addView(liInflater.inflate(R.layout.main_particularcategoryallnewslist, null));
linear.addView(liInflater.inflate(R.layout.main_particularcategoryallnewslistfv, null));
footer = (View)getLayoutInflater().inflate(R.layout.main_particularcategoryallnewslistfv, null);
btnmore = (Button)findViewById(R.id.btn_more);
ListView lv = (ListView) findViewById(android.R.id.list);
SimpleAdapter adapter = new SimpleAdapter(this, fillMaps,
R.layout.main_particularcategoryallnewslist, from, to);
lv.addFooterView(footer); <-- how to set footer being clickable?
lv.setAdapter(adapter);
Run Code Online (Sandbox Code Playgroud)
在页脚中,我有一个按钮但我设置了监听器也没有响应,我认为页脚必须启用才能点击然后才能点击按钮.
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
Intent intent = new Intent(Main_ParticularCategoryAllNews.this,
Main_ParticularNewsDetail.class);
bundle = new Bundle();
bundle.putInt("newsid", newsid[arg2]);
intent.putExtras(bundle);
startActivity(intent);
} …Run Code Online (Sandbox Code Playgroud) 在Android(构建后)中,我们在bin文件夹中找到扩展名文件.apk.
在我的BlackBerry项目中,我找不到类似的内容apk,我想知道BlackBerry Java应用程序的扩展名是什么?
这是java
maintitle = (TextView)findViewById(R.id.text_particularlatestnewstitle);
maintitle.setPadding(100, 0, 0, 0);
Run Code Online (Sandbox Code Playgroud)
alllatestnewslist.xml这里
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_temp"
android:layout_width="fill_parent"
android:layout_height="100px"
android:background="@drawable/background_news_list" >
<ImageView
android:id="@+id/image_alllatestnewstitle"
android:layout_width="134px"
android:layout_height="80px"
android:layout_marginBottom="5px"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_marginTop="5px"
android:scaleType="centerCrop" />
<LinearLayout
android:id="@+id/test"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5px"
android:layout_marginLeft="100px"
android:layout_marginRight="10px"
android:layout_marginTop="5px"
android:orientation="vertical" >
<TextView
android:id="@+id/text_particularlatestnewstitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="25px" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25px" >
<TextView
android:id="@+id/text_newsdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#999999"
android:textSize="15px" />
<TextView
android:id="@+id/text_newscategorytitle"
android:layout_width="50px"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:gravity="right"
android:textColor="#ff0000"
android:textSize="15px" />
</RelativeLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
在这个xml中,我有其他对象,如图像视图和textview等.
我这样设置,但它不会离开左边100 ........................
任何其他方式?????????????????????
这个类扩展了baseadapter
public View getView(int position, View convertView, ViewGroup parent) {
if (!imagepath[position].toString().equals("no picture")) {
imageLoader.DisplayImage(imagepath[position], imageview);
}
}
public void DisplayImage(String url, ImageView imageView) {
imageViews.put(imageView, url);
Bitmap bitmap = memoryCache.get(url);
if (bitmap != null) {
imageView.setImageBitmap(bitmap);
} else {
queuePhoto(url, imageView);
}
}
Run Code Online (Sandbox Code Playgroud)
假设第一个视图应首先检查显示,但现在检查后显示.
if (!imagepath[position].toString().equals("no picture")) {
titletext.setPadding(imageview.getWidth() + 5, 0, 0, 0);
datetext.setPadding(imageview.getWidth() + 5, 0, 0, 0);
imageview.setVisibility(View.VISIBLE);
imageLoader.DisplayImage(imagepath[position], imageview);
} else {
imageview.setVisibility(View.INVISIBLE);
imageview.setImageDrawable(null);
titletext.setPadding(0, 0, 0, 0);
datetext.setPadding(0, 0, 0, 0);
}
titletext.setText(title[position].toString());
categorytext.setText(category[position].toString()); …Run Code Online (Sandbox Code Playgroud) 我想在我的应用程序之外创建一个alertdialog.
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(Config_ConstantVariable.latest);
builder.setMessage(title);
builder.setIcon(R.drawable.push_logo);
builder.setCancelable(false)
.setPositiveButton(Config_ConstantVariable.alertbtnyes,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(context,
Main_ParticularNewsDetail.class);
Bundle bundle = new Bundle();
intent.putExtra("newsid", payload);
intent.putExtras(bundle);
context.startActivity(intent);
}
})
.setNegativeButton(Config_ConstantVariable.alertbtnno,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
Run Code Online (Sandbox Code Playgroud)
但是,这context不是一个活动而且这个类是extends BroadcastReceiver.
当我推送通知时,发生错误,
06-18 18:38:08.629: E/AndroidRuntime(2402): Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for …Run Code Online (Sandbox Code Playgroud) android ×9
baseadapter ×1
blackberry ×1
footer ×1
gridview ×1
imageview ×1
java ×1
layoutparams ×1
listview ×1
margin ×1
onclick ×1
padding ×1
popup ×1
rotation ×1
textview ×1