我下载android-studio-bundle-130.677228-windows
并安装在我的电脑上.但是当我试图启动android工作室时,那里什么也没发生......它没有启动,没有错误.我也尝试以管理员身份运行它,但没有工作.那里的实际问题是什么?有人遇到过同样的问题吗?
我正在使用Android Studio
最新版本,最近面临一个问题,如果我更改了资源或更改了我的布局xml Design
视图没有快速更新.我发现再次更新布局.但我的项目有点大,需要一些时间再次重建.如果有任何其他快速解决方案,那将是很好的.我也尝试过Synchronize xml选项,但没有按预期工作.如果有更好的选择,请建议我.谢谢.background from selector
image resource background
Rebuild Project
有一个java.lang.ClassCastException
当我试图让安装的应用程序图标.
这是我的代码.
public Bitmap getAppIcon(String path) {
PackageInfo pi = pm.getPackageArchiveInfo(path, 0);
pi.applicationInfo.sourceDir = path;
pi.applicationInfo.publicSourceDir = path;
Drawable icon = pi.applicationInfo.loadIcon(pm);
Bitmap APKicon = ((BitmapDrawable) icon).getBitmap();
return APKicon;
}
Run Code Online (Sandbox Code Playgroud)
在哪里,pm
是
PackageManager pm = getPackageManager();
Run Code Online (Sandbox Code Playgroud)
并且显示的错误LogCat
是
Caused by: java.lang.ClassCastException: android.graphics.drawable.NinePatchDrawable cannot be cast to android.graphics.drawable.BitmapDrawable
Run Code Online (Sandbox Code Playgroud)
希望有人可以帮助我.
正如标题所说,我有3个Circle.
每个人都有不同的半径.我知道每个圆圈的半径.
也知道每个圆的中心点.
现在我需要知道如何以编程方式计算三个圆的交叉点,是否有任何公式或什么?
它可能看起来像下面的图像
我有一个vector
绘画.
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:autoMirrored="true"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#65666a"
android:pathData="M8.59,16.34l4.58,-4.59 -4.58,-4.59L10,5.75l6,6 -6,6z" />
</vector>
Run Code Online (Sandbox Code Playgroud)
我添加android:autoMirrored="true"
了支持RTL的属性,但它仅用于API 19及更高版本.但我的最低API级别是API 17.如何添加后向可比性?任何帮助,将不胜感激.
我正在尝试创建一个应用程序,让您扫描可用的无线网络,然后将它们显示在可选择的列表中.为此,我尝试使用此代码:
package android.nacho.WifiScan;
import java.util.List;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
public class WifiScan extends Activity {
TextView mainText;
WifiManager mainWifi;
WifiReceiver receiverWifi;
List<ScanResult> wifiList;
StringBuilder sb = new StringBuilder();
ListView listView = new ListView(this);
ArrayAdapter<String> adapter;
Context context = this;
static String[] NETWORKS;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wifi_scan);
mainText = (TextView) …
Run Code Online (Sandbox Code Playgroud) 我遇到了一个我还没看到的问题.有时我的ActionBarActivity中的布局xml文件显示奇怪的行为.某些线性布局和自定义样式操作栏的背景颜色显示应用颜色的不同阴影.有时它按预期完美运作.这是我的问题的截图.
预期结果
有时我会这样
我的布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/submitButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:background="@drawable/login_button_selector"
android:text="@string/submit"
android:textColor="@color/white" />
<TextView
android:id="@+id/titleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_margin="10dp"
android:text="@string/add_food"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/theme_red" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/submitButton"
android:layout_below="@+id/titleText"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:orientation="vertical"
android:weightSum="3" >
<!-- Time Block -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="4" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/theme_red"
android:gravity="center" >
<TextView
android:id="@+id/timeTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/time"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="3"
android:weightSum="5" > …
Run Code Online (Sandbox Code Playgroud) 我正在使用FFImageLoading而不是Image
在我的项目中使用占位符等更高级的功能。在我的项目中,有一个需要显示的图像列表。所以我使用了一个列表视图。
<ListView x:Name="membersList" ItemTapped="Handle_ItemTappedMember" HorizontalOptions="FillAndExpand" HasUnevenRows="true" SeparatorVisibility="None" BackgroundColor="#EEEEEE" Grid.Row="0" Grid.Column="0">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal" Padding="5,5,5,5" HeightRequest="75" Margin="10,5,10,5" BackgroundColor="White" HorizontalOptions="FillAndExpand">
<ffimageloading:CachedImage Source="{Binding imageUrl}" x:Name="patImage" WidthRequest="60" HeightRequest="60" Aspect="AspectFill" VerticalOptions="Center">
<ffimageloading:CachedImage.Transformations>
<fftransformations:CircleTransformation />
</ffimageloading:CachedImage.Transformations>
</ffimageloading:CachedImage>
<StackLayout Spacing="3" Orientation="Vertical" VerticalOptions="Center" HorizontalOptions="FillAndExpand">
<Label FontAttributes="Bold" FontSize="14" TextColor="#212121" Text="{Binding FullName}" />
<Label FontSize="12" TextColor="#212121" Text="{Binding Relation}" />
<Label FontSize="12" TextColor="#212121" Text="{Binding Pat_ID}" />
</StackLayout>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Run Code Online (Sandbox Code Playgroud)
我的问题是我不想在这里使用缓存技术,因为我的服务器图像可能会在不更改 URL 的情况下更改。
我知道如何使用 FFImageLoading 清除单个图像视图的缓存
await CachedImage.InvalidateCache(Image.Source, CacheType.All, true);
Run Code Online (Sandbox Code Playgroud)
但是如何在 …
我有一个可以缩放的imageview.我有一个运行良好的代码,但我的问题是我想添加最大和最小缩放级别的限制.
import android.annotation.TargetApi;
import android.app.ActionBar;
import android.app.Activity;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.os.Build;
import android.os.Bundle;
import android.util.FloatMath;
import android.util.Log;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class Reach extends Activity implements OnTouchListener
{
private static final String TAG = "Touch";
@SuppressWarnings("unused")
private static final float MIN_ZOOM = 1f,MAX_ZOOM = 1f;
// These matrices will be used to scale points of the image
Matrix matrix = new Matrix();
Matrix savedMatrix = new Matrix();
// The 3 …
Run Code Online (Sandbox Code Playgroud) 我想在mainactivity中单击后退按钮时添加退出警告.为此,我使用此代码
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
final Dialog dialoge=new Dialog(MainActivity.this,android.R.style.Theme_Translucent_NoTitleBar);
dialoge.setContentView(R.layout.popup_layout);
Button yes=(Button)dialoge.findViewById(R.id.yes);
yes.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
MainActivity.this.finish();
}
});
Button no=(Button)dialoge.findViewById(R.id.no);
no.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
dialoge.cancel();
}
});
dialoge.show();
}
Run Code Online (Sandbox Code Playgroud)
这是有效的,但退出时显示一些错误.
Logcat是
03-21 10:25:57.192: E/WindowManager(14488): Activity com.example.design.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@447fec28 that was originally added here
03-21 10:25:57.192: E/WindowManager(14488): android.view.WindowLeaked: Activity com.example.design.MainActivity has leaked …
Run Code Online (Sandbox Code Playgroud)