小编Ram*_*amz的帖子

在android studio中检测到框架

检测到框架:在项目Configure中检测到Android框架

当我尝试在android studio 1.4中构建一个特定项目时,我得到了上述消息

该项目为空白,无法运行此项目.我搜索了解决方案,没有找到任何正确的解决方案.

我遇到了这个答案/sf/answers/1287600401/,但根据这个,在我的情况下,"Android支持存储库"已经安装在sdk管理器中.这个解决方案对我没有帮助.

任何帮助表示赞赏.谢谢.

android

23
推荐指数
4
解决办法
4万
查看次数

cardCornerRadius显示错误

我正在学习android材料设计,但在它之间不断给出错误.谁可以帮我这个事?

workspace/RecyclerCardView/res/layout/list_item_row.xml:2:错误:在'com.Zybo.recyclercardview'包中找不到属性'cardCornerRadius'的资源标识符

<android.support.v7.widget.CardView  xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
card_view:cardCornerRadius="5dp" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/img_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="7dp" />

    <TextView
        android:id="@+id/txt_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hellooo..." />
</LinearLayout>

</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)

xml android

15
推荐指数
4
解决办法
3万
查看次数

xml文件中的未知感叹号

在xml文件中获取未知的感叹错误图像视图,当我尝试在"android:background"属性中设置涟漪效果时.

我评论了我收到此错误的行.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="15dp"
>

<ImageView
    android:id="@+id/tabImage"
    android:layout_width="match_parent"
    android:background="@drawable/tab_bg" <!-- Line where I get error-->
    android:layout_height="wrap_content"
    android:layout_gravity="center" />

<TextView
    android:id="@+id/tabText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="bottom|center" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

如果我点击该感叹号,它会指向以下文件.

V22/tab_bg.xml

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item android:id="@+id/mask"
    android:drawable="@android:color/white"/>

</ripple>
Run Code Online (Sandbox Code Playgroud)

应用程序运行正常,但我无法获得这种连锁反应.

注意:我使用的是Android Studio 1.4

android android-layout

8
推荐指数
1
解决办法
3074
查看次数

ClassCastException:Main Activity必须实现onFragmentInteractonListener

当我尝试为导航抽屉项实现onClick时,我收到了ClassCastException。

请在下面找到代码。

我无法弄清楚哪里出了问题

主要活动:

public class MainActivity extends AppCompatActivity implements FragmentDrawer.FragmentDrawerListener {

Toolbar toolbar;
ViewPager pager;
ViewPagerAdapter adapter;
SlidingTabLayout tabs;
CharSequence Titles[] = {"CITY", "GO", "NEAR"};
int Numboftabs = 3;
private FragmentDrawer drawerFragment;
private Handler mHandler;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    // Creating The Toolbar and setting it as the Toolbar for the activity

    toolbar = (Toolbar) findViewById(R.id.app_bar);
    setSupportActionBar(toolbar);


    // Creating The ViewPagerAdapter and Passing Fragment Manager, Titles fot the Tabs and Number Of Tabs.
    adapter = …
Run Code Online (Sandbox Code Playgroud)

android android-fragments navigation-drawer

0
推荐指数
1
解决办法
961
查看次数

存储在内部存储器中时如何为图像生成随机名称?

我正在开发的Android应用程序基本上是一个购物应用程序,它有一个Cart选项,用户可以在其中添加项目.

物品有图像,名称,价格等.

我从服务器获取所有这些数据.

当用户单击"添加到购物车"选项时,将创建一个sqlite数据库,其中存储名称,价格和图像路径.

当点击添加到购物车并且只有图像路径存储在数据库中时,基本上Imgaes存储在内部存储器中.

问题:

要将图像存储在内部存储器中,我使用下面的代码,我将自己给出文件名(在这种情况下,我将文件名称为profile.jpg).

SaveToMemory:

 private String saveToInternalSorage(Bitmap bitmapImage){
    ContextWrapper cw = new ContextWrapper(getApplicationContext());
    // path to /data/data/yourapp/app_data/imageDir
     directory = cw.getDir("imageDir", Context.MODE_PRIVATE);
    // Create imageDir
    mypath=new File(directory,"profile.jpg");
    FileOutputStream fos = null;
    try {
        fos = new FileOutputStream(mypath);
        // Use the compress method on the BitMap object to write image to the OutputStream
        bitmapImage.compress(Bitmap.CompressFormat.PNG, 100, fos);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try {
            fos.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    } …
Run Code Online (Sandbox Code Playgroud)

sqlite android

0
推荐指数
2
解决办法
5625
查看次数

当我全局声明latlong值时获取零点异常

我使用共享首选项获得latlong值并将其存储为double值.
全局声明latlong值.
获得零点异常.尝试了在全球范围内宣布价值观的不同方式,但似乎没有任何效果.

MainActivity.java

public class MapsActivityConnect extends FragmentActivity {
ImageView emerg;
SharedPreferences pref;
String vechile;
Double deslatituded, deslongituded, srclatituded, srclongituded;
private GoogleMap mMap = null;
private final LatLng end = new LatLng(deslatituded, deslongituded);
private final LatLng start = new LatLng(srclatituded, srclongituded);
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_maps_activity_connect);

    pref = getSharedPreferences("gps", Context.MODE_PRIVATE);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        deslatituded = extras.getDouble("deslatitude");
        deslongituded = extras.getDouble("deslongitude");


        srclatituded = extras.getDouble("srclatitude");
        srclongituded = extras.getDouble("srclongitude");
        vechile = extras.getString("vechile");

        if (!Utils.isConnected(getApplicationContext())) …
Run Code Online (Sandbox Code Playgroud)

java android

-1
推荐指数
1
解决办法
1726
查看次数